UndoManager
The UndoManager class observes and records model changes and supports undo and redo operations.
Implementa: IUndoManager
Construtores
UndoManager()
Create a UndoManager that is ready to record model modifications, but that does not know about any models yet.
Propriedades
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.
Métodos
AddModel(IDiagramModel)
Make sure this undo manager knows about a IDiagramModel for which it is receiving model Changed event notifications.
- model
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
Retorna: 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
Retorna: 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
Retorna: 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
Retorna: 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.
Retorna: 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
Retorna: 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.
Retorna: true if starting a top-level transaction
Undo()
Restore the state of some models to before the current IUndoableEdit.