WP8.1 windows phone 8.1 二次退出
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();//完全退出 } } }