/// <summary> /// Handles the KeyDown event of the Window control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="KeyEventArgs"/> instance containing the event data.</param> private void Window_KeyDown(object sender, KeyEventArgs e) { try { if (e.Key == Key.Escape) { NewGameWindow parent = new NewGameWindow(); this.DialogResult = true; parent.ShowDialog(); } } catch (Exception error) { errorLogViewModel.LogError(error); } }
/// <summary> /// Handles the Click event of the NewGameButton control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param> private void NewGameButton_Click(object sender, RoutedEventArgs e) { try { NewGameWindow childWindow = new NewGameWindow(); this.Close(); childWindow.ShowDialog(); } catch (Exception error) { errorLogViewModel.LogError(error); } }
/// <summary> /// Handles the KeyDown event of the Window control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="KeyEventArgs"/> instance containing the event data.</param> private void Window_KeyDown(object sender, KeyEventArgs e) { try { // The escape key was pushed. if (e.Key == Key.Escape) { NewGameWindow parent = new NewGameWindow(); this.DialogResult = true; parent.ShowDialog(); } } catch (Exception error) { errorLogViewModel.LogError(error); } }