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;
     }
 }
Ejemplo n.º 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));
            }
        }
Ejemplo n.º 5
0
 public bool RestorePointExists(RestorePointToken restorePoint)
 {
     return(this.UndoOperationCollection.RestorePointExists(restorePoint));
 }
Ejemplo n.º 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));
        }
Ejemplo n.º 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)));
 }
Ejemplo n.º 10
0
 public RestorePoint(string name)
 {
     this.Name  = name;
     this.Token = new RestorePointToken(name);
 }
Ejemplo n.º 11
0
 public static void UndoTo( object trackedObject, RestorePointToken token )
 {
     ITrackedObject to = CheckObject( trackedObject );
     ((AggregateTracker)to.Tracker).UndoTo( token );
 }
Ejemplo n.º 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));
 }