Click here to Skip to main content
14,029,357 members
Rate this:
 
Please Sign up or sign in to vote.
See more:
I have several buttons that are mef plugin's to a separate application, and are displayed by that apps' view model. I need to also be able to control the status and toggle of those buttons from a windows service. Possible, and where can I look? Using .Net 4.0
Posted

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

The question is way too vague to give the exact advice. You did not describe your existing architecture and what have you tried. You did not explain what could be your problem.

But the idea could be this: you should remember that your windows service works even if there is no a desktop, so none of the UI applications even exist. So, the collaboration you need should be established by the initiative of your UI application, which is inline with the concept of "client-server".

You have to create some network or, more appropriately, IPC service in your windows service. It could be done directly using sockets or named pipes, or, on a higher level, using "classic" remoting or WCF hosted in your windows service. The UI application should be able to connect to the service (presumably, on their startop and disconnect before their termination) and subscribe to some service events (whatever you need to introduce). In the handlers of those events, the UI application can change the states of the buttons or whatever you need to change. The server should remain agnostic of the UI behavior. This way, you would support loose coupling and avoid strong coupling, which is very important in this case.

Please see also:
http://en.wikipedia.org/wiki/Loose_coupling[^],
http://en.wikipedia.org/wiki/Coupling_(computer_science)[^].

—SA
   
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Cookies | Terms of Service
Web03 | 2.8.190419.4 | Last Updated 3 Jun 2014
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100