public void Redo() { isInUndoRedo = true; IMemento <T> top = redoStack.Pop(); undoStack.Push(top.Restore(subject)); isInUndoRedo = false; }
/// <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; }
public void Undo() { if (mementos.Count == 0) { return; } IMemento lastMemento = mementos.Last(); mementos.Remove(lastMemento); lastMemento.Restore(); }
public void Undo() { mapMemento.Restore(); robotMemento.Restore(); }
public void SetMemento(IMemento <TState> memento) { State = memento.Restore(); }
protected override Task RollbackAsync() { state.Restore(); return(base.RollbackAsync()); }