public void Undo() { EndUndoCollection(); //just in case this wasn't called before if (undoStack.Count > 0) { var undoable = undoStack.Pop(); var redoable = undoable.Revert(this); redoStack.Push(new RedoEntry { undoable = undoable, redoable = redoable }); Reverted?.Invoke(this, new RevertedEventArgs(redoable)); ObjectsMoved?.Invoke(this, null); if (undoStack.Count == 0) { IsSaved = LastSavedUndo == null; } else { IsSaved = LastSavedUndo == undoStack.Peek(); } } }
public void Redo() { if (redoStack.Count > 0) { var entry = redoStack.Pop(); entry.redoable.Revert(this); undoStack.Push(entry.undoable); Reverted?.Invoke(this, new RevertedEventArgs(entry.undoable)); ObjectsMoved?.Invoke(this, null); IsSaved = undoStack.Peek() == LastSavedUndo; } }
/// <summary> /// Restores <see cref="Value"/> to <see cref="DefaultValue"/>. /// </summary> public void Revert() { Value = defaultValue; Reverted?.Invoke(value); }
public void Revert() { data = def; Reverted?.Invoke(def); }