有没有办法以编程方式退出我的应用程序?(Windows 电话 7) [英] Is there a way to programmatically quit my App? (Windows Phone 7)

查看:23
本文介绍了有没有办法以编程方式退出我的应用程序?(Windows 电话 7)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写 Windows Phone 7 应用程序.我有致命异常"处理代码,我确信该应用程序已被完全破坏并且没有继续操作的意义.(我希望我永远不会到这里......).由于我的应用程序除了退出之外别无他法,我希望用户能够关闭应用程序.

I'm writing a windows phone 7 app. I have "fatal exception" handling code where I know for sure that the app is totally busted and there's no point in continuing. (I'm hoping I never get here...). Since there's nothing more my app can do other than quit I want the user to be able to close the app.

但我注意到 Silverlight 4 SDK for Windows Phone 7 中没有 System.Environment.Exit().还有其他方法可以以编程方式退出应用程序吗?

But I noticed there is no System.Environment.Exit() in the Silverlight 4 SDK for Windows Phone 7. Is there another way to quit the app programmatically?

推荐答案

App Cert Reqt:

App Cert Reqt:

5.1.2 申请终止

该应用程序必须处理异常由 .NET Framework 提出,而不是意外终止.在此期间认证流程、申请被监控意外终止.一个应用程序意外终止失败认证.处理时例外,应用程序必须提供用户友好的错误消息.您可能会显示一条消息与上下文相关应用.申请必须继续运行并保持响应异常后的用户输入处理. 显示一般或无用的错误消息将无法通过认证.

The application must handle exceptions raised by the .NET Framework and not terminate unexpectedly. During the certification process, the application is monitored for unexpected termination. An application that terminates unexpectedly fails certification. When handling exceptions, an application must provide a user-friendly error message. You may present a message that is relevant to the context of the application. The application must continue to run and remain responsive to user input after the exception is handled. An application that displays generic or unhelpful error messages will fail certification.

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

I would recommend you provide any information you feel relevant to the user and then leave the navigation of the device to the user to manage in light of this.

承认提供退出"按钮的已知解决方案,目前我没有看到从 WP7 应用程序实现退出"的令人信服的理由.

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() 虽然可用于 xna,但实际上也不再需要了.在 CTP 期间有一项证书要求,游戏必须提供退出按钮.现在没有了.

.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.

这篇关于有没有办法以编程方式退出我的应用程序?(Windows 电话 7)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆