码迷,mamicode.com
首页 > Windows程序 > 详细

WP8.1 windows phone 8.1 二次退出

时间:2016-08-11 20:50:56      阅读:261      评论:0      收藏:0      [点我收藏+]

标签:

public MainPage()
{

HardwareButtons.BackPressed += HardwareButtons_BackPressed; //注册后退键

}

private void HardwareButtons_BackPressed(object sender, Windows.Phone.UI.Input.BackPressedEventArgs e)
{
Frame frame = Window.Current.Content as Frame;
if(frame==null)
{
return;
}
if(frame.CanGoBack)
{
frame.GoBack();
e.Handled = true;  //正常页面的推出
}
else
{
Back_Key++;//记录器
if (Back_Key == 1) { Main_Pivot.Opacity = 0.5; Back_Text.Visibility = Visibility.Visible; Back_Border.Visibility = Visibility.Visible; Main_Pivot.IsEnabled = false;

DT = new DispatcherTimer();//计时器
DT.Interval = new TimeSpan(0, 0, 1);

DT.Start();
DT.Tick += DT_Tick;
e.Handled = true;
}
else
{

App.Current.Exit();//完全退出
}

}

}

WP8.1 windows phone 8.1 二次退出

标签:

原文地址:http://www.cnblogs.com/T-ARF/p/5762272.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!