Some time ago I mentioned thinking about a project on Local History. This project is still in a very conceptive application. But I already know that I want to have Windows Service and a Windows UI. More on other details later, but now let’s talk about communication between the Windows Service and the Windows UI.
It’s possible to do some very basic communication with a Windows Service. This can be done like this:
1 protected override void OnCustomCommand(int command)
2 {
3 base.OnCustomCommand(command);
4 //Do your handling.
5 }
1 ServiceController sc = new ServiceController("WindowsServiceName");
2 int customCommand = 21;
3 sc.ExecuteCommand(customCommand);
Yes you can see this are just very basic commands, you can send integers to the Windows Service that it needs to handle. I’m sure there are enough samples to find that only needs this basic commands. But I need more, much more.