Search code examples
wpfwindows-10-universaldesktop-bridge

How to restart a Desktop Bridge app programmatically


I have a Desktop Bridge app which needs to have a "Restart" button.

I've got it calling RequestRestartAsync method on the CoreApplication (described in this blog post) - but at runtime it fails with reason "NotInForeground".

I wonder if this is because of the way the Desktop Bridge technology wraps the WPF application. Any ideas on how I can cause the app to restart?


Solution

  • This is a new feature which is introduced from Windows 10 Fall Creators Update (v10.0.16299.0). Please note that not all UWP APIs are available for desktop bridge apps. You could check this document UWP APIs available to a packaged desktop app (Desktop Bridge). The CoreApplication relevant APIs have not been listed on the document. So, you cannot use this APIs in desktop bridge app now.