public void TrackCommand(ICommand command) { UndoStack.Push(command); RedoStack.Clear(); var args = new UndoRedoEventArgs(UndoRedoAction.UndoPush | UndoRedoAction.RedoClear, command.DisplayText); UndoRedoChanged?.Invoke(this, args); }
public void Redo() { if (RedoStack.Count == 0) { return; } var command = RedoStack.Pop(); command.Execute(); UndoStack.Push(command); var args = new UndoRedoEventArgs(UndoRedoAction.RedoPop | UndoRedoAction.UndoPush, command.DisplayText); UndoRedoChanged?.Invoke(this, args); }
private void UpdateUndoRedo() { UndoRedoChanged.Raise(this); }
/// <summary> /// The undo redo changed. /// React to change /// </summary> /// <param name="obj"> /// The obj. /// </param> private void UndoRedoChanged(UndoRedoChanged obj) { if (obj == Infrastructure.Enums.UndoRedoChanged.UndoChanged) { this.CanUndo = this.undoRedo.CanUndo; } if (obj == Infrastructure.Enums.UndoRedoChanged.RedoChanged) { this.CanRedo = this.undoRedo.CanRedo; } }