public CatchOperationsFromHistoryForDelegatedPrimitive(MockTextUndoHistory history, MockTextUndoPrimitive primitive, DelegatedUndoPrimitiveState state) { _history = history; _primitive = primitive; primitive.State = state; history.ForwardToUndoOperation(primitive); }
public MockTextUndoHistory(MockTextUndoHistoryRegistry undoHistoryRegistry) { _currentTransaction = null; UndoHistoryRegistry = undoHistoryRegistry; _undoStack = new Stack <ITextUndoTransaction>(); _redoStack = new Stack <ITextUndoTransaction>(); _activeUndoOperationPrimitive = null; _state = TextUndoHistoryState.Idle; }
/// <summary> /// This method ends the lifetime of the activeUndoOperationPrimitive and should be called after ForwardToUndoOperation. /// </summary> /// <param name="primitive">The previously active delegated primitive--used for sanity check.</param> public void EndForwardToUndoOperation(MockTextUndoPrimitive primitive) { if (_activeUndoOperationPrimitive != primitive) { throw new InvalidOperationException(); } _activeUndoOperationPrimitive = null; }