protected void RedoCommandExecute() { if (CurrentTabItem == null || !DicRedoCommands.Keys.Contains(CurrentTabItem)) { return; } if (DicRedoCommands[CurrentTabItem].Count > 0) { IUndoRedoCommand command = DicRedoCommands[CurrentTabItem].Pop(); if (command != null) { command.Redo(); DicUndoCommands[CurrentTabItem].Push(command); } } }
public void Redo() { IUndoRedoCommand cmd = _undoRedoStack[_pointer]; if (cmd.CheckExecutionContext()) // if command is no longer valid dispose it { cmd.Redo(); _pointer++; } else { _undoRedoStack.RemoveAt(_pointer); } _onUndoAction?.Invoke(); _onRedoAction?.Invoke(); }
public static void ExecuteAndPush(this IUndoRedoStack stack, IUndoRedoCommand command) { command.Redo(); stack.Push(command); }