Ejemplo n.º 1
0
        protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
        {
            var selectionCmd = new TextSelectionCommand(textView, selectionView, caretView);

            if (selectionCmd.CanExecute(e))
            {
                selectionCmd.Execute(e);
            }
        }
Ejemplo n.º 2
0
        protected override void OnMouseMove(MouseEventArgs e)
        {
            var selectionCmd        = new TextSelectionCommand(textView, selectionView, caretView);
            var canExecuteSelection = selectionCmd.CanExecute(e);

            if (canExecuteSelection)
            {
                selectionCmd.Execute(e);
            }
        }
Ejemplo n.º 3
0
        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);
            }
        }