예제 #1
0
 /// <summary>
 /// This is only called for "Redo," not for the original "Do." The action is to redo everything in the list of
 /// redo operations, and then clear the list. While this is happening, the History will collect new operations
 /// for the undo list and pass them on to us.
 /// </summary>
 public void Do()
 {
     using (new CatchOperationsFromHistoryForDelegatedPrimitive(_history, this, DelegatedUndoPrimitiveState.Redoing)) {
         while (RedoOperations.Count > 0)
         {
             RedoOperations.Pop()();
         }
     }
 }
예제 #2
0
 /// <summary>
 /// This is called by the UndoHistory implementation when we are mid-undo/mid-redo and
 /// the history receives a new UndoableOperation. The action is then to add that operation
 /// to the inverse list.
 /// </summary>
 /// <param name="operation"></param>
 public void AddOperation(UndoableOperationCurried operation)
 {
     if (_state == DelegatedUndoPrimitiveState.Redoing)
     {
         _undoOperations.Push(operation);
     }
     else if (_state == DelegatedUndoPrimitiveState.Undoing)
     {
         RedoOperations.Push(operation);
     }
     else
     {
         throw new InvalidOperationException("Strings.DelegatedUndoPrimitiveStateDoesNotAllowAdd");
     }
 }