public void AddOperation(Operation op) { stackUndo.Push(op); stackRedo.Clear(); if (!undoStatus) { undoStatus = true; UndoStatusChanged?.Invoke(undoStatus); } if (redoStatus) { redoStatus = false; RedoStatusChanged?.Invoke(redoStatus); } }
public void Redo() { if (stackRedo.Any()) { var op = stackRedo.Pop(); op.Invoke(); stackUndo.Push(op); if (!undoStatus) { undoStatus = true; UndoStatusChanged?.Invoke(undoStatus); } if (redoStatus && !stackRedo.Any()) { redoStatus = false; RedoStatusChanged?.Invoke(redoStatus); } } }