private void ClearRedoStack() { if (InternalRedoStack.Count > 0) { InternalRedoStack.Clear(); OnPropertyChanged(new PropertyChangedEventArgs("CanRedo")); } }
void EnforceSizeLimit() { AssertNoUndoGroupOpen(); while (InternalUndoStack.Count > _sizeLimit) { InternalUndoStack.DequeueTail(); } while (InternalRedoStack.Count > _sizeLimit) { InternalRedoStack.DequeueTail(); } }
/// <summary> /// Redoes the last undone operation. /// </summary> public void Redo() { AssertNoUndoGroupOpen(); if (InternalRedoStack.Count > 0) { IUndoableOperation operation = InternalRedoStack.DequeueHead(); InternalUndoStack.EnqueueHead(operation); operation.Do(); OnOperationRedone(); if (InternalRedoStack.Count == 0) { OnPropertyChanged(new PropertyChangedEventArgs("CanRedo")); } if (InternalUndoStack.Count == 1) { OnPropertyChanged(new PropertyChangedEventArgs("CanUndo")); } EnforceSizeLimit(); } }