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

            undoStack.Push(top.Restore(subject));
            isInUndoRedo = false;
        }
Exemplo n.º 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;
     }
 }
Exemplo n.º 3
0
        /// <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;
        }
Exemplo n.º 4
0
        public void Undo()
        {
            if (mementos.Count == 0)
            {
                return;
            }

            IMemento lastMemento = mementos.Last();

            mementos.Remove(lastMemento);

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