如何退出 Windows Phone 7 应用程序? [英] How to Exit windows phone 7 app?

查看:36
本文介绍了如何退出 Windows Phone 7 应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能的重复:
Windows Phone 7 关闭应用程序
以编程方式关闭 WP7 应用程序?
有没有办法以编程方式退出我的应用程序?(Windows Phone 7)

大家好,有什么办法可以退出 Windows Phone 7 中的应用程序.我的 EULA.xaml 和 MainPage.xaml 问题已解决,但在任何一种情况下都必须退出 MainPage.xaml 上的应用程序.提前致谢.

Hi All, Is there any way to exit application in windows phone 7. My problem with EULA.xaml and MainPage.xaml is solved but have to exit my app on MainPage.xaml in either of the cases. Thanks in advance.

推荐答案

WP7-Silverlight 中没有标准 API 来执行此操作.诀窍是您可以抛出未处理的异常,这可能导致应用程序中断并转到 WindowsPhone 的开始菜单.

There is no standard API to do this in WP7-Silverlight. The trick is that you can throw an un-handled exception and that can cause the app to break and go to start menu of WindowsPhone.

public class ExitException :Exception {}

然后把它扔到你想退出的地方.

and throw this where ever you want to quit.

throw new ExitException();

这篇关于如何退出 Windows Phone 7 应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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