|
-
Aug 13th, 2003, 10:55 AM
#1
Thread Starter
Addicted Member
How would you do it?
I have a Windows Service and need a Windows Forms based User Interface so I can control, configure and monitor the service.
Now it's pretty straight forward to be able to start, stop, pause the service but does anyone have any recommendations as to how I will communicate between the service and the user interface?
Typical actions will be:
- Pass XML dataset from the Service to the UI when requested
- Update Service variables (e.g. Options) from the UI
- Execute/Call Service functions from the UI
So has anyone worked with this kind of architecture before? I have a few ideas but would like to hear some recommendations or opinions.
Thanks!
Justy.
-
Aug 13th, 2003, 11:00 AM
#2
I'd say your best bet is remoting. Have the service remote some kind of controller class that an exe can link into and use.
-
Aug 13th, 2003, 02:45 PM
#3
Fanatic Member
well, I'm going to suggest an alternative to Edneeis's method (which is probably a lot more proper than mine, but i gotta do it just to bug Edneeis and resist Remoting )..
anyways... You may see under the evnets you can handle in your windows service one called "OnCustomCommand(command As Integer)" ... from the ServiceControllerClass, you can call the OnCustomCommand and send any integer you want to the windows service this way..
as you can imagine, this is a bit limiting since it only allows you to pass integers.... But you could easily do something like put a string at a specific location in the registry and then call the OnCustomCommand and then retrieve that registry value in the windows service...
This method of course is a bit hack, but would work nicely if you need very simple communication...
-
Aug 13th, 2003, 03:26 PM
#4
Ahh Redth, i'd have been disappointed if you hadn't shot down the idea of using remoting 
Whats a good idea for a service? Just to use in an example, something fairly simple.
-
Aug 13th, 2003, 04:42 PM
#5
Addicted Member
Originally posted by Redth
well, I'm going to suggest an alternative to Edneeis's method (which is probably a lot more proper than mine, but i gotta do it just to bug Edneeis and resist Remoting )..
anyways... You may see under the evnets you can handle in your windows service one called "OnCustomCommand(command As Integer)" ... from the ServiceControllerClass, you can call the OnCustomCommand and send any integer you want to the windows service this way..
as you can imagine, this is a bit limiting since it only allows you to pass integers.... But you could easily do something like put a string at a specific location in the registry and then call the OnCustomCommand and then retrieve that registry value in the windows service...
This method of course is a bit hack, but would work nicely if you need very simple communication...
To expand on this idea, if your service has a fixed set of parameters then you could just pass in a bit-wise value and determine the number of parameters to enable/disable, based on that value.
-
Aug 14th, 2003, 03:23 AM
#6
Thread Starter
Addicted Member
Thanks fellas.. was already aware of Redth's method of communicating but it's a bit too limiting in this situation. Remoting sounds interesting though so I'm off to do some reading!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|