protected override void OnKeyDown(KeyEventArgs e) { var removeTextCmd = new RemoveTextCommand(textView, caretView, selectionView); var caretMoveCmd = new CaretMoveCommand(caretView, textView); var selectionCmd = new TextSelectionCommand(textView, selectionView, caretView); var deselectionCmd = new TextDeselectionCommand(selectionView); if (removeTextCmd.CanExecute(e)) { ExecuteTextCommand(removeTextCmd, new UndoRemoveTextCommand(textView, caretView), e); deselectionCmd.Execute(); } else if (caretMoveCmd.CanExecute(e)) { caretMoveCmd.Execute(e); deselectionCmd.Execute(); } else if (selectionCmd.CanExecute(e)) { selectionCmd.Execute(e); } }
protected override void OnMouseDown(MouseButtonEventArgs e) { var caretMoveCmd = new CaretMoveCommand(caretView, textView); if (caretMoveCmd.CanExecute(e)) { caretMoveCmd.Execute(e); } selectionView.HandleMouseDown(e); textView.HandleMouseDown(e); }