Table of Contents

Class ChangeTracker

Namespace
TimeCockpit.Data
Assembly
TimeCockpit.Data.dll

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

public class ChangeTracker
Inheritance
Object
ChangeTracker
Inherited Members
Object.ToString()
Object.Equals(Object)
Object.Equals(Object, Object)
Object.ReferenceEquals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()

Constructors

ChangeTracker()

Initializes a new instance of the ChangeTracker class.

public ChangeTracker()

Properties

CanEndScope

Gets a value indicating whether EndScope can be called safely.

public bool CanEndScope { get; }

Property Value

Boolean

CanRedo

Gets a value indicating whether calling Redo will have an effect.

public bool CanRedo { get; }

Property Value

Boolean

CanUndo

Gets a value indicating whether calling Undo will have an effect.

public bool CanUndo { get; }

Property Value

Boolean

RedoStack

Gets the stack of operations that can be redone / applied

public Stack<Operation> RedoStack { get; }

Property Value

Stack<Operation>

TrackedObjects

Gets the tracked objects of type EntityObject.

public IEnumerable<EntityObject> TrackedObjects { get; }

Property Value

IEnumerable<EntityObject>

The tracked objects.

UndoStack

Gets the stack of operations that can be undone.

public Stack<Operation> UndoStack { get; }

Property Value

Stack<Operation>

Methods

Add(IEnumerable<EntityObject>)

Adds the specified entity objects.

public void Add(IEnumerable<EntityObject> entityObjects)

Parameters

entityObjects IEnumerable<EntityObject>

The entity objects.

Exceptions

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.

public void Add(EntityObject entityObject)

Parameters

entityObject EntityObject

The EntityObject to track.

Exceptions

System.ArgumentException

An element with the same key already exists in the collection.

BeginScope()

adds a begin scope operation.

public void BeginScope()

Clear()

Clears all the instances of EntityObject that have been tracked by this instance.

public void Clear()

ClearUndoRedoStacks()

clears the undo / redo history.

public void ClearUndoRedoStacks()

EndScope()

adds an EndScope operation.

public void EndScope()

HasChanges()

Determines whether any of the tracked objects has changes.

public bool HasChanges()

Returns

Boolean

true if any of the tracked objects has changes; otherwise, false.

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

public void Redo()

Remove(IEnumerable<EntityObject>)

Removes the specified instances of EntityObjects from the collection.

public void Remove(IEnumerable<EntityObject> entityObjects)

Parameters

entityObjects IEnumerable<EntityObject>

The EntityObjects to remove from the collection.

Remove(EntityObject)

Removes the specified EntityObject from the collection of tracked EntityObjects.

public void Remove(EntityObject entityObject)

Parameters

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

public void Undo()

UpdateAllCanStates()

Updates all state properties, CanUndo, CanRedo and CanEndScope

public void UpdateAllCanStates()

Events

CanEndScopeChanged

Event triggered when the CanEndScope property changed.

public event EventHandler CanEndScopeChanged

Event Type

EventHandler

CanRedoChanged

Event triggered when the CanRedo property changed.

public event EventHandler CanRedoChanged

Event Type

EventHandler

CanUndoChanged

Event triggered when the CanUndo property changed.

public event EventHandler CanUndoChanged

Event Type

EventHandler