如何关闭的Windows Phone 8.1的应用程序 [英] How to close a Windows Phone 8.1 app

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

问题描述

在WP7和WP8我只需要清除一个页面backstack,然后按返回键,应用程序被关闭。在WP8.1我Frame.BackStack.Clear(),按返回和应用程序只是最小化。如何与后退按钮杀了它?

In WP7 and WP8 I just needed to clear the backstack in a page, then press Back button and the app is closed. In WP8.1 I do Frame.BackStack.Clear(), press Back and the app just minimizes.. How to kill it with Back button?

推荐答案

您可以添加在你的主页定义:

You can add, in your main page definition:

Windows.Phone.UI.Input.HardwareButtons.BackPressed += HardwareButtons_BackPressed;



然后

Then

private void HardwareButtons_BackPressed(object sender, Windows.Phone.UI.Input.BackPressedEventArgs e)
{
    if (!e.Handled && Frame.CurrentSourcePageType.FullName == "YourApp.MainPage")
        Application.Current.Exit();
}

警告:正如有人说,你不应该使用此,让系统来处理应用程序关闭。例如,如果您使用的应用程序见解,我发现他们不是在释放模式时,发送到Azure的

Warning: As others said, you should not use this and let the system handle the app closure. For example, if you use the Application Insights, I found that they are not sent to Azure when in Release mode

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

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