DiagramModel
The common base class for all predefined model classes.
Properties
public string DataFormat { get; set; }
value = diagramModel.DataFormat
diagramModel.DataFormat = value
Gets or sets the format of this model's data.
public bool HasUndoManager { get; }
value = diagramModel.HasUndoManager
Whether undo manager exists. Returns false if the manager is suspended.
protected bool Initializing { get; set; }
value = diagramModel.Initializing
diagramModel.Initializing = value
Gets or sets whether the model is being constructed or re-constructed.
public bool IsChangingModel { get; protected set; }
value = diagramModel.IsChangingModel
diagramModel.IsChangingModel = value
This property is true during a call to Boolean), indicating a change happening due to an undo or a redo.
public bool IsInTransaction { get; }
value = diagramModel.IsInTransaction
This property is true after a String) and before a corresponding String) or RollbackTransaction.
public bool IsModified { get; set; }
value = diagramModel.IsModified
diagramModel.IsModified = value
Gets or sets whether this model is considered changed from an earlier state.
public bool IsUndoManagerSuspended { get; set; }
value = diagramModel.IsUndoManagerSuspended
diagramModel.IsUndoManagerSuspended = value
Undo manager is suspended if this property is set to true.
public bool Modifiable { get; set; }
value = diagramModel.Modifiable
diagramModel.Modifiable = value
Gets or sets whether various model-changing methods are enabled.
public string Name { get; set; }
value = diagramModel.Name
diagramModel.Name = value
A name for this model.
public bool SkipsUndoManager { get; set; }
value = diagramModel.SkipsUndoManager
diagramModel.SkipsUndoManager = value
Gets or sets a flag that tells ModelChangedEventArgs) whether it should notify any UndoManager that a change has occurred.
public UndoManager UndoManager { get; set; }
value = diagramModel.UndoManager
diagramModel.UndoManager = value
Gets or sets the UndoManager for this model.
Methods
protected virtual void ChangeDataValue(ModelChangedEventArgs e, bool undo)
diagramModel.ChangeDataValue(e, undo)
This is called during undo or redo to effect state changes to model data.
- e
- an edit describing the change to be performed
- undo
- true if undoing; false if redoing
public void ChangeModel(ModelChangedEventArgs e, bool undo)
diagramModel.ChangeModel(e, undo)
This is called during an Undo or a Redo to actually make state changes to this model or to this model's data.
- e
- an edit describing the change to be performed
- undo
- true if undoing; false if redoing
protected virtual void ChangeModelValue(ModelChangedEventArgs e, bool undo)
diagramModel.ChangeModelValue(e, undo)
This is called during undo or redo to effect state changes to this model.
- e
- an edit describing the change to be performed
- undo
- true if undoing; false if redoing
public bool CommitTransaction(string tname)
result = diagramModel.CommitTransaction(tname)
Call the UndoManager's CommitTransaction method.
- tname
- a String describing the transaction
Returns: the value of the call to CommitTransaction
protected virtual void OnChanged(ModelChangedEventArgs e)
diagramModel.OnChanged(e)
Raises the Changed event.
- e
- an edit describing the change that just happened
public void RaiseChanged(ModelChangedEventArgs e)
diagramModel.RaiseChanged(e)
Raise a Changed event, given a ModelChangedEventArgs.
- e
- an edit describing the change that just happened
public void RaisePropertyChanged(string propname, object data, object oldval, object oldparam, object newval, object newparam)
diagramModel.RaisePropertyChanged(propname, data, oldval, oldparam, newval, newparam)
Raise a Changed event for a property change.
- propname
- a property name
- data
- the object whose property has just changed
- oldval
- the previous value for the property
- oldparam
- additional information for the old value
- newval
- the new value for the property
- newparam
- additional information for the new value
public void RaisePropertyChanged(string propname, object data, object oldval, object newval)
diagramModel.RaisePropertyChanged(propname, data, oldval, newval)
Raise a Changed event, given before and after values for a particular property.
- propname
- a property name
- data
- the object whose property has just changed
- oldval
- the previous value for the property
- newval
- the new value for the property
protected virtual void Reinitialize()
diagramModel.Reinitialize()
Reset the fields that should not be shared from a copy created by MemberwiseClone.
public bool RollbackTransaction()
result = diagramModel.RollbackTransaction()
Call the UndoManager's RollbackTransaction method.
Returns: the value of the call to RollbackTransaction
public bool StartTransaction(string tname)
result = diagramModel.StartTransaction(tname)
Call the UndoManager's StartTransaction method.
- tname
- a String describing the transaction
Returns: the value of the call to StartTransaction
Events
public event EventHandler<ModelChangedEventArgs> Changed
diagramModel.Changed += handler
The Changed event is raised whenever the model is modified.