private void ButtonBack_Click(object sender, RoutedEventArgs e) { ImageTools.ApplyBlur(Application.Current.MainWindow); var result = MessageBox.Show("All your progress will be lost. Leave current game?", "Confirmation required", MessageBoxButton.YesNo); ImageTools.SupressEffects(Application.Current.MainWindow); if (result.Equals(MessageBoxResult.Yes)) { NavigationService?.Navigate(new StartView()); } }
/// <summary> /// This is the event callback for the main window's close button. /// </summary> /// <remarks> A MessageBox is shown to confirm if the user wants to exit de game. While open, /// the background window will be shown blurred. The effect disappears if the user cancels. /// </remarks> /// <param name="sender"></param> /// <param name="e"></param> private void NavigationWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e) { ImageTools.ApplyBlur(Application.Current.MainWindow); var result = MessageBox.Show("Are you sure you want to exit?", "Confirmation Required", MessageBoxButton.YesNo); ImageTools.SupressEffects(Application.Current.MainWindow); if (result.Equals(MessageBoxResult.No)) { e.Cancel = true; } }