예제 #1
0
 private void AddUndoableAction(TextBoxBase sender, UndoAction action)
 {
     if (action == UndoAction.Undo)
     {
         redoStack.Push(new UndoOperation(sender, action));
     }
     else
     {
         if (undoStack.Count > 0)
         {
             UndoOperation op = undoStack.Peek();
             if ((op.Sender == sender) && (action == UndoAction.Merge))
             {
                 // no-op
             }
             else
             {
                 PushUndoOperation(sender, action);
             }
         }
         else
         {
             PushUndoOperation(sender, action);
         }
     }
 }
예제 #2
0
 public void Redo()
 {
     if (redoStack.Count > 0)
     {
         UndoOperation op = redoStack.Pop();
         op.Sender.Redo();
         op.Sender.Focus();
     }
 }
예제 #3
0
 public void Undo()
 {
     if (undoStack.Count > 0)
     {
         UndoOperation op = undoStack.Pop();
         op.Sender.Undo();
         op.Sender.Focus();
     }
 }