sereleg

protected override void OnStart(string[] args)
(
SetConfigParams1();

//how I use this after SetConfigparams1() was used, i need to process the window services with the new values from SetConfigParams2()


SetConfigParams2();
timer.Enabled = true
)

.....more code

I need to update a Window Service which works fine with just SetConfigParams1(). My task is to call an additional method called SetConfigParam2() (both methods contain different config information from the app.config file but the variables's names are the same for both). How can I used each method sequencially one after the other. Any help will be appreciated.
Thanks



Re: Visual C# General Windows Service help

TaylorMichaelL

Could you be more precise about what you're trying to do Calling one method after the other you probably understand so I don't quite get what you're asking. Are you trying to update the same fields in the second method that you updated in the first (sort of like a cascading or layering configuration) or are you trying to get a completely new set of configuration options that you need to store in addition to the first set

Michael Taylor - 3/20/07
http://p3net.mvps.org





Re: Visual C# General Windows Service help

KingCobra

Hi

Though the question is not clear, I suppose that you are trying to ask a question how to set a time interval using the value obtained from a method SetConfigParams1() intially and change the timer interval to SetConfigParams2()'s value.

The Following VB code helps you in setting a different time interval for a service.

' VB Code

Timer1.Enabled = False

Timer1.Interval = SetConfigParams1() ' considering the method SetConfigParams1() returns the interval time

Timer1.Enabled = True

If the above said was not your question, then I am sorry and please be more specific.






Re: Visual C# General Windows Service help

KingCobra

Hi,

And one more information to mention here is that whenever the Timer interval is changed, the Timer needs to be stopped and started for the new Time interval to get into effect.