gpt4 book ai didi

c# - 如何关闭 Windows Phone 8.1 应用程序

转载 作者:可可西里 更新时间:2023-11-01 08:18:01 26 4
gpt4 key购买 nike

在 WP7 和 WP8 中,我只需要清除页面中的后退堆栈,然后按“返回”按钮,应用程序就会关闭。在 WP8.1 中,我执行 Frame.BackStack.Clear(),按返回键,应用程序就最小化了。如何使用返回键终止它?

最佳答案

您可以在主页定义中添加:

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

然后

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

警告:正如其他人所说,您不应该使用它并让系统处理应用程序关闭。例如,如果您使用 Application Insights,我发现在 Release 模式下它们不会发送到 Azure

关于c# - 如何关闭 Windows Phone 8.1 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25625378/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com