有没有办法以编程方式退出我的应用程序?(Windows Phone 7)

wil*_*ill 12 silverlight-4.0 windows-phone-7

我正在写一个Windows Phone 7应用程序.我有"致命异常"处理代码,我知道该应用程序完全被破坏,并且没有任何意义继续.(我希望我永远不会来这里......)由于我的应用程序除了退出之外别无其他功能,我希望用户能够关闭应用程序.

但是我注意到System.Environment.Exit()在Windows Phone 7的Silverlight 4 SDK中没有.还有另一种以编程方式退出应用程序的方法吗?

Mic*_*k N 9

App Cert Reqt:

5.1.2申请终止

应用程序必须处理.NET Framework引发的异常,而不是意外终止.在认证过程中,将监视应用程序是否意外终止.意外终止的应用程序无法通过认证.处理异常时,应用程序必须提供用户友好的错误消息.您可以提供与应用程序上下文相关的消息.在处理异常后,应用程序必须继续运行并保持对用户输入的响应.显示通用或无用错误消息的应用程序将无法通过认证.

我建议您提供与用户相关的任何信息,然后将设备导航留给用户进行管理.

Acknowledging known solutions to provide "Exit" buttons, currently I do not see a compelling reason to implement an "exit" from a WP7 application.

The platform is fully capable of managing closure of apps. The more apps don't provide an exit, the quicker users will become accustomed to not thinking about app house keeping, and let the platform manage it.

The user will just navigate their device using start, back, etc.

If the user wants out of the current app to go do something else quickly - easy - they just hit start.

.Exit(), whilst available for xna, really isn't required anymore either. There was a cert requirement during CTP that games had to provide an exit button. This is now gone.

Non game apps never had the need to implement this.

The more this topic's discussed (and it really has been given a good run around the block), the more the indicators to me suggest there is no need to code an exit.