Reputation: 25050
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?
Upvotes: 0
Views: 831
Reputation: 5225
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.
Upvotes: 1