From last article “HOW TO COMMUNICATE BETWEEN METRO UI AND DESKTOP UI ON WIN8”, it talking about to pass the control between Metro/Desktop application.
However during programing on Metro and Desktop, you might need some communication mechanism for Metro/Desktop application.
I just provide my experience for this kind of question, here is my solution for communicate between Metro and Desktop on Win8 Customer Preview. (I also feedback on MSFT forum here)
-
Write a application to listen TCP as information center which call “DesktopSvr” (ex: here)
-
Metro app try to send message to localhost via streamsocket (P.S. localhost is not work, but 127.0.0.1 work well).
-
“DesktopSvr” will pass desktop app via IPC or anyway you familiar.
Metro application communication guidline:
-
Desktop might also pass some data to “DesktopSvr” it will be our information center.
-
Metro:
-
Since Metro UI will not get any TCP feedback if app under suspends, so communicate between metro app via TCP seems not possible here.
-
Metro app only get TCP event when it is remain as alive. (ex: StreamSocket.)
-
Metro app only take feedback and response when event register. (ex: SystemTriggerType), so Metro app might need take more pooling query information to our “DesktopSvr”.
-
Metro app might not to communicate to another Metro app, it is possible for “Metro A” to pass to “DesktopSvr” and “Metro B” also try to retrival information to “Desktop”.
-
-
Desktop:
-
Desktop is easy to communicate with other desktop app via original way.
-
Desktop might also need pass information to “DesktopSvr” first, and Metro app will try to get it from “DesktopSvr”.
-