我知道可以使用 MSApp.terminateApp
来终止该应用程序。重新启动应用程序怎么样?有没有重启的命令?
最佳答案
重新启动不符合 Windows 8 应用程序概念(以前称为 Metro)。如果您进入不可恢复的状态,那么正确的做法是让它崩溃并让 Windows 从那里处理它。
来自here :
App crash
Apps are required to follow the system crash experience, which is to simply return to the Start screen. The system crash experience is designed to get users back to what they were doing as quickly as possible, so you shouldn't provide a warning dialog or other notification because that'll cause a delay for the user. The disappearance of the app should make it clear to the user that something went wrong.
If your app crashes, stops responding, or generates an exception, Windows asks the user for consent to send a problem report to Microsoft. Microsoft provides a subset of the error data in the problem report to you so that you can use it to improve your app. You'll be able to see this data in your app's Quality page in your Dashboard in the Windows Dev Center for Metro style apps. (Note that you can't submit apps or view your app's data until the Windows Store opens for general submissions.)
When the user activates an app after it crashes, its activation event handler receives an ApplicationExecutionState value of NotRunning, and should simply display its initial UI and data.
关于windows-store-apps - 以编程方式重新启动 Windows 应用商店应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11962230/