Class ChangeTracker
Represents a class that keeps track of changes. One can add/remove either a single instance of EntityObject or a collection of EntityObjects. and can perform a save operation on the tracked instances. An instance of ChangeTracker should organize various instance of EntityObjects (perhaps if different ModelEntity types) into a logical structure that can be stored within a transaction
Inheritance
Inherited Members
Namespace: TimeCockpit.Data
Assembly: TimeCockpit.Data.dll
Syntax
public class ChangeTracker
Constructors
ChangeTracker()
Initializes a new instance of the ChangeTracker class.
Declaration
public ChangeTracker()
Properties
CanEndScope
Gets a value indicating whether EndScope can be called safely.
Declaration
public bool CanEndScope { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
CanRedo
Gets a value indicating whether calling Redo will have an effect.
Declaration
public bool CanRedo { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
CanUndo
Gets a value indicating whether calling Undo will have an effect.
Declaration
public bool CanUndo { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
RedoStack
Gets the stack of operations that can be redone / applied
Declaration
public Stack<Operation> RedoStack { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.Stack<Operation> |
TrackedObjects
Gets the tracked objects of type EntityObject.
Declaration
public IEnumerable<EntityObject> TrackedObjects { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<EntityObject> | The tracked objects. |
UndoStack
Gets the stack of operations that can be undone.
Declaration
public Stack<Operation> UndoStack { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.Stack<Operation> |
Methods
Add(IEnumerable<EntityObject>)
Adds the specified entity objects.
Declaration
public void Add(IEnumerable<EntityObject> entityObjects)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<EntityObject> | entityObjects | The entity objects. |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | An element with the same key already exists in the dictionary. |
Add(EntityObject)
Adds the specified EntityObject to the collection of tracked EntityObjects.
Declaration
public void Add(EntityObject entityObject)
Parameters
Type | Name | Description |
---|---|---|
EntityObject | entityObject | The EntityObject to track. |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | An element with the same key already exists in the collection. |
BeginScope()
adds a begin scope operation.
Declaration
public void BeginScope()
Clear()
Clears all the instances of EntityObject that have been tracked by this instance.
Declaration
public void Clear()
ClearUndoRedoStacks()
clears the undo / redo history.
Declaration
public void ClearUndoRedoStacks()
EndScope()
adds an EndScope operation.
Declaration
public void EndScope()
HasChanges()
Determines whether any of the tracked objects has changes.
Declaration
public bool HasChanges()
Returns
Type | Description |
---|---|
System.Boolean |
|
Redo()
if there is an operation that can be redone removes the operation from the redo stack adds the operation to the undo stack. redoes the operation
Declaration
public void Redo()
Remove(IEnumerable<EntityObject>)
Removes the specified instances of EntityObjects from the collection.
Declaration
public void Remove(IEnumerable<EntityObject> entityObjects)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<EntityObject> | entityObjects | The EntityObjects to remove from the collection. |
Remove(EntityObject)
Removes the specified EntityObject from the collection of tracked EntityObjects.
Declaration
public void Remove(EntityObject entityObject)
Parameters
Type | Name | Description |
---|---|---|
EntityObject | entityObject | The EntityObject to remove from the collection. |
Undo()
If there is an operation that can be undone removes the operation from the undo stack adds the operation to the redo stack undos the operation
Declaration
public void Undo()
UpdateAllCanStates()
Updates all state properties, CanUndo, CanRedo and CanEndScope
Declaration
public void UpdateAllCanStates()
Events
CanEndScopeChanged
Event triggered when the CanEndScope property changed.
Declaration
public event EventHandler CanEndScopeChanged
Event Type
Type | Description |
---|---|
System.EventHandler |
CanRedoChanged
Event triggered when the CanRedo property changed.
Declaration
public event EventHandler CanRedoChanged
Event Type
Type | Description |
---|---|
System.EventHandler |
CanUndoChanged
Event triggered when the CanUndo property changed.
Declaration
public event EventHandler CanUndoChanged
Event Type
Type | Description |
---|---|
System.EventHandler |