예제 #1
0
        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());
        }
예제 #2
0
        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);
            }
        }
예제 #3
0
 public void Add(IListTOfVMemento <T, U> m)
 {
     mementos.Add(m);
 }
예제 #4
0
 private void _Do(IListTOfVMemento <T, U> m)
 {
     redoStack.Clear();
     undoStack.Push(m);
 }