Bring up desktop app from Start(or metro) screen in Windows 8 programatically

£可爱£侵袭症+ 提交于 2019-12-08 13:06:13

问题


I am writing a LOB WPF program which gives some text alert (just simple MessageBox.Show();) to user.

But as you imagine, the desktop app that I wrote does NOT be displayed to user unless the user switches to Desktop mode by clicking "Desktop" tile.

I tried to use InputSimulator in order to press Win+D virtually, but exception was thrown.

How can I bring up desktop app to foreground programatically?


回答1:


If I'm understanding the question correctly, you aren't writing an additional Windows Store/Metro app as well...you just want the user to see the alert raised by your WPF desktop app even if they are currently in a full-screen Windows Store/Metro app and not on the desktop.

To solve this problem, I recommend using the toast notification system. You can send toast notifications from either Windows Store apps or desktop apps, so your WPF app could raise a toast notification instead of using your text alert/MessageBox.Show() mechanism. This toast notification will be displayed to the user no matter where they are...on the desktop, on the Start screen, in a Windows Store/Metro app...does this solve your problem?

Here is the documentation on sending toast notifications from desktop apps. It also links to a quickstart code walkthrough.



来源:https://stackoverflow.com/questions/14959958/bring-up-desktop-app-from-startor-metro-screen-in-windows-8-programatically

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!