private void UndoToRestorePoint(Func <Stack <Operation> > getOperationsToRestorePoint, Action <Operation> pushToRedoAction, string name) { if (!this.UndoRedoOperationEnabledCheck()) { return; } using (this.StartDisabledTrackingScope()) { OperationCollection undoOperations = this.UndoOperationCollection.Clone(); OperationCollection redoOperations = this.RedoOperationCollection.Clone(); Stack <Operation> operationsToUndo = getOperationsToRestorePoint(); var operationsForParentTracker = operationsToUndo.ToList(); operationsForParentTracker.Reverse(); this.AddUndoOperationToParentTracker(name, operationsForParentTracker, undoOperations, redoOperations); while (operationsToUndo.Count > 0) { Operation operation = operationsToUndo.Pop(); operation.Undo(); pushToRedoAction(operation); } } }
private void RedoInternal(bool addToParent) { OperationCollection undoOperations = null; OperationCollection redoOperations = null; if (addToParent) { undoOperations = this.UndoOperationCollection.Clone(); redoOperations = this.RedoOperationCollection.Clone(); } var operation = this.RedoOperationCollection.Pop(); if (operation == null) { return; } if (addToParent) { this.AddUndoOperationToParentTracker(string.Format(this.NameGenerationConfiguration.RedoOperationStringFormat, operation.Name), operation, undoOperations, redoOperations); } operation.Redo(); this.UndoOperationCollection.Push(operation); if (operation.IsRestorePoint()) { this.RedoInternal(addToParent); } }
protected Tracker(bool enableTracking = false) { this.UndoOperationCollection = new OperationCollection(); this.RedoOperationCollection = new OperationCollection(); this.IsTrackingInternal = true; this.IsTracking = enableTracking; }
public ObjectTrackerOperation(AggregateTracker tracker, string name, OperationCollection undoOperations, OperationCollection redoOperations, List <Operation> currentOperations) { this.Tracker = tracker; this.UndoOperations = undoOperations; this.RedoOperations = redoOperations; this.CurrentOperations = currentOperations; this.Name = name; }
public ObjectTrackerOperation( AggregateTracker tracker, string name, OperationCollection undoOperations, OperationCollection redoOperations, List<Operation> currentOperations ) { this.Tracker = tracker; this.UndoOperations = undoOperations; this.RedoOperations = redoOperations; this.CurrentOperations = currentOperations; this.Name = name; }
public void Clear() { OperationCollection undoOperations = this.UndoOperationCollection.Clone(); OperationCollection redoOperations = this.RedoOperationCollection.Clone(); this.AddUndoOperationToParentTracker("Clear", new List <Operation>(), undoOperations, redoOperations); this.UndoOperationCollection.Clear(); this.RedoOperationCollection.Clear(); }
internal virtual void AddUndoOperationToParentTracker(string name, Operation operation, OperationCollection undoOperations, OperationCollection redoOperations) { this.AddUndoOperationToParentTracker(name, new List <Operation> { operation }, undoOperations, redoOperations); }
internal abstract void AddUndoOperationToParentTracker(string name, List <Operation> operations, OperationCollection undoOperations, OperationCollection redoOperations);
internal override void AddUndoOperationToParentTracker( string name, List<Operation> operations, OperationCollection undoOperations, OperationCollection redoOperations ) { }
internal virtual void AddUndoOperationToParentTracker( string name, Operation operation, OperationCollection undoOperations, OperationCollection redoOperations ) { this.AddUndoOperationToParentTracker( name, new List<Operation> { operation }, undoOperations, redoOperations ); }
internal abstract void AddUndoOperationToParentTracker( string name, List<Operation> operations, OperationCollection undoOperations, OperationCollection redoOperations );
internal void SetOperationCollections(OperationCollection undoOperations, OperationCollection redoOperations) { this.UndoOperationCollection = undoOperations; this.RedoOperationCollection = redoOperations; }
internal override void AddUndoOperationToParentTracker( string name, List<Operation> operations, OperationCollection undoOperations, OperationCollection redoOperations ) { if (this.ParentTracker != null) { this.ParentTracker.AddOperation( new ObjectTrackerOperation( this, name, undoOperations, redoOperations, operations.Where(o => o != null).Select(o => InvertOperationWrapper.InvertOperation(o, this.NameGenerationConfiguration.UndoOperationStringFormat)).ToList())); } }
internal override void AddUndoOperationToParentTracker(string name, List <Operation> operations, OperationCollection undoOperations, OperationCollection redoOperations) { if (this.ParentTracker != null) { this.ParentTracker.AddOperation( new ObjectTrackerOperation( this, name, undoOperations, redoOperations, operations.Where(o => o != null).Select(o => InvertOperationWrapper.InvertOperation(o, this.NameGenerationConfiguration.UndoOperationStringFormat)).ToList())); } }