コード例 #1
0
ファイル: Tracker.cs プロジェクト: olachan/PostSharp-Toolkits
        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);
                }
            }
        }
コード例 #2
0
ファイル: Tracker.cs プロジェクト: olachan/PostSharp-Toolkits
        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);
            }
        }
コード例 #3
0
ファイル: Tracker.cs プロジェクト: olachan/PostSharp-Toolkits
 protected Tracker(bool enableTracking = false)
 {
     this.UndoOperationCollection = new OperationCollection();
     this.RedoOperationCollection = new OperationCollection();
     this.IsTrackingInternal = true;
     this.IsTracking = enableTracking;
 }
コード例 #4
0
ファイル: Tracker.cs プロジェクト: olachan/PostSharp-Toolkits
 protected Tracker(bool enableTracking = false)
 {
     this.UndoOperationCollection = new OperationCollection();
     this.RedoOperationCollection = new OperationCollection();
     this.IsTrackingInternal      = true;
     this.IsTracking = enableTracking;
 }
コード例 #5
0
 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;
 }
コード例 #6
0
 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;
 }
コード例 #7
0
ファイル: Tracker.cs プロジェクト: olachan/PostSharp-Toolkits
        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();
        }
コード例 #8
0
ファイル: Tracker.cs プロジェクト: olachan/PostSharp-Toolkits
 internal virtual void AddUndoOperationToParentTracker(string name, Operation operation, OperationCollection undoOperations, OperationCollection redoOperations)
 {
     this.AddUndoOperationToParentTracker(name, new List <Operation> {
         operation
     }, undoOperations, redoOperations);
 }
コード例 #9
0
ファイル: Tracker.cs プロジェクト: olachan/PostSharp-Toolkits
 internal abstract void AddUndoOperationToParentTracker(string name, List <Operation> operations, OperationCollection undoOperations, OperationCollection redoOperations);
コード例 #10
0
 internal override void AddUndoOperationToParentTracker( string name, List<Operation> operations, OperationCollection undoOperations, OperationCollection redoOperations )
 {
 }
コード例 #11
0
ファイル: Tracker.cs プロジェクト: olachan/PostSharp-Toolkits
 internal virtual void AddUndoOperationToParentTracker( string name, Operation operation, OperationCollection undoOperations, OperationCollection redoOperations )
 {
     this.AddUndoOperationToParentTracker( name, new List<Operation> { operation }, undoOperations, redoOperations );
 }
コード例 #12
0
ファイル: Tracker.cs プロジェクト: olachan/PostSharp-Toolkits
 internal abstract void AddUndoOperationToParentTracker( string name, List<Operation> operations, OperationCollection undoOperations, OperationCollection redoOperations );
コード例 #13
0
 internal void SetOperationCollections(OperationCollection undoOperations, OperationCollection redoOperations)
 {
     this.UndoOperationCollection = undoOperations;
     this.RedoOperationCollection = redoOperations;
 }
コード例 #14
0
 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()));
     }
 }
コード例 #15
0
 internal void SetOperationCollections(OperationCollection undoOperations, OperationCollection redoOperations)
 {
     this.UndoOperationCollection = undoOperations;
     this.RedoOperationCollection = redoOperations;
 }
コード例 #16
0
 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()));
     }
 }