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); } } }
public void Redo() { if (redoStack.Count > 0) { UndoOperation op = redoStack.Pop(); op.Sender.Redo(); op.Sender.Focus(); } }
public void Undo() { if (undoStack.Count > 0) { UndoOperation op = undoStack.Pop(); op.Sender.Undo(); op.Sender.Focus(); } }