Configuring WindowsService thru SystemTray.. Urgent help

  • Thread starter Thread starter Sylesh Nair
  • Start date Start date
S

Sylesh Nair

hi ,

I have a System tray application which configures a Windows Service through
it (Both written in C#). I have the service polling to a database table
every 30 seconds , the time interval is hard coded into the Service code .
What I need is to configure the time interval thru the SystemTray
application .
Please advice me on How to do it ?.

Thanks
Sylesh
 
Sylesh,

It's just a matter of communicating with the service using the
application you already have. Whatever mechanism you are using, extend it
to send a message or call a method that will set this property. When the
service receives the message/call, it should stop the timer, set the new
interval, and restart.

Hope this helps.
 
As Nicholas proposed, I thought about a trivial (but maybe not so useful)
example of a communication between those 2 application.
It could be through a configuration file in which the SysTray application
should write a new value for an existing setting. The service will read from
time to time the value and restart the timer with the new value for
"interval".



Nicholas Paldino said:
Sylesh,

It's just a matter of communicating with the service using the
application you already have. Whatever mechanism you are using, extend it
to send a message or call a method that will set this property. When the
service receives the message/call, it should stop the timer, set the new
interval, and restart.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Sylesh Nair said:
hi ,

I have a System tray application which configures a Windows Service through
it (Both written in C#). I have the service polling to a database table
every 30 seconds , the time interval is hard coded into the Service code ..
What I need is to configure the time interval thru the SystemTray
application .
Please advice me on How to do it ?.

Thanks
Sylesh
 
Hi Nicholas &FG,
thanks a lot for the reply ..
but how do i write to a configuration file , that's meant to be read-only .
I used the IsolatedFileStorage class in C# but that does not work on runtime
..
sylesh


FG said:
As Nicholas proposed, I thought about a trivial (but maybe not so useful)
example of a communication between those 2 application.
It could be through a configuration file in which the SysTray application
should write a new value for an existing setting. The service will read from
time to time the value and restart the timer with the new value for
"interval".



message news:O%[email protected]...
Sylesh,

It's just a matter of communicating with the service using the
application you already have. Whatever mechanism you are using, extend it
to send a message or call a method that will set this property. When the
service receives the message/call, it should stop the timer, set the new
interval, and restart.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Sylesh Nair said:
hi ,

I have a System tray application which configures a Windows Service through
it (Both written in C#). I have the service polling to a database table
every 30 seconds , the time interval is hard coded into the Service
code
 
Sylesh,

I don't think that the file is a good idea, as you would have to use
some sort of polling/notification mechanism. Personally, I think that you
should host a remoted object in the service, and then have the tray app
connect to the remoted object and perform the communication through there.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Sylesh Nair said:
Hi Nicholas &FG,
thanks a lot for the reply ..
but how do i write to a configuration file , that's meant to be read-only ..
I used the IsolatedFileStorage class in C# but that does not work on runtime
.
sylesh


FG said:
As Nicholas proposed, I thought about a trivial (but maybe not so useful)
example of a communication between those 2 application.
It could be through a configuration file in which the SysTray application
should write a new value for an existing setting. The service will read from
time to time the value and restart the timer with the new value for
"interval".



message news:O%[email protected]...
extend
it
to send a message or call a method that will set this property. When the
service receives the message/call, it should stop the timer, set the new
interval, and restart.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

hi ,

I have a System tray application which configures a Windows Service
through
it (Both written in C#). I have the service polling to a database table
every 30 seconds , the time interval is hard coded into the Service
code
.
What I need is to configure the time interval thru the SystemTray
application .
Please advice me on How to do it ?.

Thanks
Sylesh
 
Back
Top