protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e) { var selectionCmd = new TextSelectionCommand(textView, selectionView, caretView); if (selectionCmd.CanExecute(e)) { selectionCmd.Execute(e); } }
protected override void OnMouseMove(MouseEventArgs e) { var selectionCmd = new TextSelectionCommand(textView, selectionView, caretView); var canExecuteSelection = selectionCmd.CanExecute(e); if (canExecuteSelection) { selectionCmd.Execute(e); } }
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); } }