UndoManager

StockSharp.Xaml.Diagram.GXDiagram.Model

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

实现: IUndoManager

构造函数

UndoManager()

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

属性

ChecksTransactionLevel : bool

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

CompoundEdits : IList<IUndoableEdit>

Gets a list of all of the compound edits.

CurrentEdit : CompoundEdit

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

CurrentTransactionName : string

Gets the current transaction name given by String).

EditToRedo : IUndoableEdit

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

EditToUndo : IUndoableEdit

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

IsUndoingRedoing : bool

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

MaximumEditCount : int

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

Models : IEnumerable<IDiagramModel>

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

NestedTransactionNames : IList<string>

Gets a stack of ongoing transaction names.

TransactionLevel : int

Gets the current transaction level.

UndoEditIndex : int

Gets the index into CompoundEdits for the current undoable edit.

方法

AddModel(IDiagramModel)

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

model
CanRedo() : bool

This predicate is true when one can call Redo.

CanUndo() : bool

This predicate is true when one can call Undo.

Clear()

Clear all of the CompoundEdits and reset all other state.

CommitCompoundEdit(CompoundEdit) : CompoundEdit

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

返回值: By default, the unmodified .

CommitTransaction(string) : bool

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

tname
the transaction name

返回值: the value of the call to String)

EndTransaction(bool, string) : bool

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

返回值: true for a committed top-level transaction

FindPrimaryObject(IUndoableEdit) : object

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

edit
an IUndoableEdit, usually either a ModelChangedEventArgs or a CompoundEdit

返回值: 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(object, ModelChangedEventArgs)

Create an IUndoableEdit for a Changed event.

sender
e
Redo()

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

RemoveModel(IDiagramModel)

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

model
RollbackTransaction() : bool

Just call String), rolling back the current transaction.

返回值: the value of the call to String)

SkipEvent(ModelChangedEventArgs) : bool

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

evt

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

StartTransaction(string) : bool

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

返回值: true if starting a top-level transaction

ToString() : string

For debugging.

Undo()

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