public U Undo() { if (tempMemento != null) { throw new InvalidOperationException("The complex memento wasn't commited."); } inUndoRedo = true; IListTOfVMemento <T, U> top = undoStack.Pop(); redoStack.Push(top.Restore(subject)); inUndoRedo = false; return(top.GetChild()); }
public void CheckPoint(IListTOfVMemento <T, U> m) { if (inUndoRedo) { throw new InvalidOperationException("Involking do within an undo/redo action."); } if (tempMemento == null) { _Do(m); } else { tempMemento.Add(m); } }
public void Add(IListTOfVMemento <T, U> m) { mementos.Add(m); }
private void _Do(IListTOfVMemento <T, U> m) { redoStack.Clear(); undoStack.Push(m); }