private void UserControl_KeyDown(object sender, KeyEventArgs e) { if (e.KeyboardDevice.Modifiers == ModifierKeys.Alt && e.SystemKey == Key.Left) { controller.MoveToPreviousQuestion(); } else if (e.KeyboardDevice.Modifiers == ModifierKeys.Alt && e.SystemKey == Key.Right) { controller.MoveToNextQuestion(); } else if (e.KeyboardDevice.Modifiers == ModifierKeys.Control && e.Key == Key.D) { RemoveQuestion.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); // Stop the character from being entered in textboxes e.Handled = true; } else if (e.KeyboardDevice.Modifiers == ModifierKeys.Control && e.Key == Key.S) { SaveQuestions.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); // Stop the character from being entered in textboxes e.Handled = true; } else if (e.Key == Key.Escape) { CloseCreator.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } }
public void SaveAndSwitchToMainWindow() { MessageBoxResult decision = MessageBox.Show( "Do you want to save question set before closing?", "Question", MessageBoxButton.YesNo ); if (decision == MessageBoxResult.Yes) { SaveQuestions.RaiseEvent(new RoutedEventArgs(Button.ClickEvent)); } SwitchToMainWindow(); }