public void BeginEdit()
 {
     if (this.restorePointToken == null)
     {
         this.restorePointToken = this.privateTracker.AddRestorePoint();
     }
 }
 public void CancelEdit()
 {
     if (this.restorePointToken != null)
     {
         this.privateTracker.UndoTo(this.restorePointToken);
         this.restorePointToken = null;
     }
 }
Пример #3
0
        public virtual void RedoTo(RestorePointToken token)
        {
            if (!this.UndoRedoOperationEnabledCheck())
            {
                return;
            }

            this.UndoToRestorePoint(
                () => this.RedoOperationCollection.GetOperationsToRestorePoint(token),
                this.UndoOperationCollection.Push,
                string.Format(this.NameGenerationConfiguration.RedoToStringFormat, token.Name));
        }
        public void Trim(RestorePointToken restorePoint)
        {
            int?index = this.RestorePointIndex(o => (o is RestorePoint) && ReferenceEquals(((RestorePoint)o).Token, restorePoint));

            if (!index.HasValue)
            {
                return;
            }

            for (int i = 0; i < index.Value; i++)
            {
                var removed = this.operations.First;
                this.operations.RemoveFirst();
                this.OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, removed));
            }
        }
Пример #5
0
 public bool RestorePointExists(RestorePointToken restorePoint)
 {
     return(this.UndoOperationCollection.RestorePointExists(restorePoint));
 }
Пример #6
0
        public virtual void UndoTo(RestorePointToken token)
        {
            if (!this.UndoRedoOperationEnabledCheck())
            {
                return;
            }

            this.UndoToRestorePoint(
                () => this.UndoOperationCollection.GetOperationsToRestorePoint(token),
                this.RedoOperationCollection.Push,
                string.Format(this.NameGenerationConfiguration.UndoToStringFormat, token.Name));
        }
Пример #7
0
 public bool RestorePointExists(RestorePointToken restorePoint)
 {
     return this.UndoOperationCollection.RestorePointExists(restorePoint);
 }
 public bool RestorePointExists(RestorePointToken token)
 {
     return(this.RestorePointIndex(o => (o is RestorePoint) && ReferenceEquals(((RestorePoint)o).Token, token)) != null);
 }
 public Stack <Operation> GetOperationsToRestorePoint(RestorePointToken token)
 {
     return(GetOperationsToRestorePoint(o => (o is RestorePoint) && ReferenceEquals(((RestorePoint)o).Token, token)));
 }
Пример #10
0
 public RestorePoint(string name)
 {
     this.Name  = name;
     this.Token = new RestorePointToken(name);
 }
Пример #11
0
 public static void UndoTo( object trackedObject, RestorePointToken token )
 {
     ITrackedObject to = CheckObject( trackedObject );
     ((AggregateTracker)to.Tracker).UndoTo( token );
 }
Пример #12
0
 public static bool RestorePointExists(object trackedObject, RestorePointToken restorePoint)
 {
     ITrackedObject to = CheckObject(trackedObject);
     return ((AggregateTracker)to.Tracker).RestorePointExists(restorePoint);
 }
 public void EndEdit()
 {
     this.restorePointToken = null;
 }
        public void Trim(RestorePointToken restorePoint)
        {
            int? index = this.RestorePointIndex(o => (o is RestorePoint) && ReferenceEquals(((RestorePoint)o).Token, restorePoint));

            if (!index.HasValue)
            {
                return;
            }

            for (int i = 0; i < index.Value; i++)
            {
                var removed = this.operations.First;
                this.operations.RemoveFirst();
                this.OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, removed));
            }
        }
 public bool RestorePointExists(RestorePointToken token)
 {
     return this.RestorePointIndex(o => (o is RestorePoint) && ReferenceEquals(((RestorePoint)o).Token, token)) != null;
 }
 public Stack<Operation> GetOperationsToRestorePoint(RestorePointToken token)
 {
     return GetOperationsToRestorePoint(o => (o is RestorePoint) && ReferenceEquals(((RestorePoint)o).Token, token));
 }