public void Redo()
        {
            isInUndoRedo = true;
            IMemento <T> top = redoStack.Pop();

            undoStack.Push(top.Restore(subject));
            isInUndoRedo = false;
        }
示例#2
0
 /// <summary>
 /// Undo an undo (=redo)
 /// </summary>
 public void Redo()
 {
     if (redoStack.Count > 0)
     {
         inUndoRedo = true;
         IMemento top = redoStack.Pop();
         undoStack.Push(top.Restore());
         inUndoRedo = false;
     }
 }
        /// <summary>
        /// Restores the subject to the next state on the redo stack, and stores the state before redoing to undo stack.
        /// Method <see cref="CanRedo()"/> can be called before calling this method.
        /// </summary>
        /// <seealso cref="Undo()"/>
        public void Redo()
        {
            if (tempMemento != null)
            {
                throw new InvalidOperationException("The complex memento wasn't commited.");
            }

            inUndoRedo = true;
            IMemento <T> top = redoStack.Pop();

            undoStack.Push(top.Restore(ref subject));
            inUndoRedo = false;
        }
示例#4
0
        public void Undo()
        {
            if (mementos.Count == 0)
            {
                return;
            }

            IMemento lastMemento = mementos.Last();

            mementos.Remove(lastMemento);

            lastMemento.Restore();
        }
示例#5
0
 public void Undo()
 {
     mapMemento.Restore();
     robotMemento.Restore();
 }
 public void SetMemento(IMemento <TState> memento)
 {
     State = memento.Restore();
 }
示例#7
0
 protected override Task RollbackAsync()
 {
     state.Restore();
     return(base.RollbackAsync());
 }