UndoManager

StockSharp.Xaml.Diagram.GXDiagram.Model

The UndoManager class observes and records model changes and supports undo and redo operations.

Implements: IUndoManager

Constructors

UndoManager
public UndoManager()
undoManager = UndoManager()

Create a UndoManager that is ready to record model modifications, but that does not know about any models yet.

Properties

ChecksTransactionLevel
public bool ChecksTransactionLevel { get; set; }
value = undoManager.ChecksTransactionLevel
undoManager.ChecksTransactionLevel = value

Gets or sets whether this undo manager will output warnings to Trace listeners when model changes occur outside of a transaction.

CompoundEdits
public IList<IUndoableEdit> CompoundEdits { get; private set; }
value = undoManager.CompoundEdits
undoManager.CompoundEdits = value

Gets a list of all of the compound edits.

CurrentEdit
public CompoundEdit CurrentEdit { get; set; }
value = undoManager.CurrentEdit
undoManager.CurrentEdit = value

Gets the current compound edit for recording additional model change events.

CurrentTransactionName
public string CurrentTransactionName { get; }
value = undoManager.CurrentTransactionName

Gets the current transaction name given by String).

EditToRedo
public IUndoableEdit EditToRedo { get; }
value = undoManager.EditToRedo

Gets the current IUndoableEdit to be redone, or null if there is none.

EditToUndo
public IUndoableEdit EditToUndo { get; }
value = undoManager.EditToUndo

Gets the current IUndoableEdit to be undone, or null if there is none.

IsUndoingRedoing
public bool IsUndoingRedoing { get; protected set; }
value = undoManager.IsUndoingRedoing
undoManager.IsUndoingRedoing = value

This property is true during a call to Undo or Redo.

MaximumEditCount
public int MaximumEditCount { get; set; }
value = undoManager.MaximumEditCount
undoManager.MaximumEditCount = value

Gets or sets the maximum number of compound edits that this undo manager will remember.

Models
public IEnumerable<IDiagramModel> Models { get; }
value = undoManager.Models

Gets a list of models for which this UndoManager is recording undo/redo information.

NestedTransactionNames
public IList<string> NestedTransactionNames { get; private set; }
value = undoManager.NestedTransactionNames
undoManager.NestedTransactionNames = value

Gets a stack of ongoing transaction names.

TransactionLevel
public int TransactionLevel { get; protected set; }
value = undoManager.TransactionLevel
undoManager.TransactionLevel = value

Gets the current transaction level.

UndoEditIndex
public int UndoEditIndex { get; protected set; }
value = undoManager.UndoEditIndex
undoManager.UndoEditIndex = value

Gets the index into CompoundEdits for the current undoable edit.

Methods

AddModel
public virtual void AddModel(IDiagramModel model)
undoManager.AddModel(model)

Make sure this undo manager knows about a IDiagramModel for which it is receiving model Changed event notifications.

model
CanRedo
public virtual bool CanRedo()
result = undoManager.CanRedo()

This predicate is true when one can call Redo.

CanUndo
public virtual bool CanUndo()
result = undoManager.CanUndo()

This predicate is true when one can call Undo.

Clear
public virtual void Clear()
undoManager.Clear()

Clear all of the CompoundEdits and reset all other state.

CommitCompoundEdit
protected virtual CompoundEdit CommitCompoundEdit(CompoundEdit cedit)
result = undoManager.CommitCompoundEdit(cedit)

This method is called by String) when committing a compound edit.

cedit
the CurrentEdit; this may be null if there had been no changes at commit time

Returns: By default, the unmodified .

CommitTransaction
public bool CommitTransaction(string tname)
result = undoManager.CommitTransaction(tname)

Just call String), committing the current transaction, with the presentation name for the transaction.

tname
the transaction name

Returns: the value of the call to String)

EndTransaction
protected virtual bool EndTransaction(bool commit, string tname)
result = undoManager.EndTransaction(commit, tname)

Stop the current transaction, either rolling it back or committing it.

commit
true to terminate the transaction normally; false to abort it and rollback the existing edits
tname
the internal locale-neutral name for the transaction

Returns: true for a committed top-level transaction

FindPrimaryObject
public virtual object FindPrimaryObject(IUndoableEdit edit)
result = undoManager.FindPrimaryObject(edit)

Given an IUndoableEdit return an edited object that represents what was modified.

edit
an IUndoableEdit, usually either a ModelChangedEventArgs or a CompoundEdit

Returns: typically a Node or a Link, but this may be null if there is no such object, perhaps because a model property was modified, or because there were no real edits in the argument .

HandleModelChanged
public virtual void HandleModelChanged(object sender, ModelChangedEventArgs e)
undoManager.HandleModelChanged(sender, e)

Create an IUndoableEdit for a Changed event.

sender
e
Redo
public virtual void Redo()
undoManager.Redo()

Restore the state of some models to after the current IUndoableEdit.

RemoveModel
public virtual void RemoveModel(IDiagramModel model)
undoManager.RemoveModel(model)

Call this method to inform this undo manager that it no longer will be notified of model Changed events.

model
RollbackTransaction
public bool RollbackTransaction()
result = undoManager.RollbackTransaction()

Just call String), rolling back the current transaction.

Returns: the value of the call to String)

SkipEvent
protected virtual bool SkipEvent(ModelChangedEventArgs evt)
result = undoManager.SkipEvent(evt)

This predicate is responsible for deciding if a ModelChangedEventArgs is not interesting enough to be recorded.

evt

Returns: normally false, which causes the given event to be remembered; but true for negative valued enumerations of ModelChange.

StartTransaction
public virtual bool StartTransaction(string tname)
result = undoManager.StartTransaction(tname)

Begin a transaction, where the changes are held by a CompoundEdit.

Returns: true if starting a top-level transaction

ToString
public override string ToString()
result = undoManager.ToString()

For debugging.

Undo
public virtual void Undo()
undoManager.Undo()

Restore the state of some models to before the current IUndoableEdit.