Table of Contents

Class ModelChangedEventArgs

Namespace
StockSharp.Xaml.Diagram.GXDiagram.Model
Assembly
StockSharp.Xaml.Diagram.dll

This class represents a change to a model.

public class ModelChangedEventArgs : PropertyChangedEventArgs, IUndoableEdit
Inheritance
ModelChangedEventArgs
Implements
Inherited Members
Extension Methods

Remarks

This inherits from PropertyChangedEventArgs so that it can be used as the EventArgs passed along for a PropertyChanged event for those data classes that implement INotifyPropertyChanged.

This also implements the StockSharp.Xaml.Diagram.GXDiagram.Model.IUndoableEdit interface so that it can be used to remember changes in a UndoManager, as part of a UndoManager.CompoundEdit.

Constructors

ModelChangedEventArgs()

The empty/default constructor produces an EventArgs whose properties still need to be initialized.

public ModelChangedEventArgs()

Remarks

This is only used internally, for representing predefined StockSharp.Xaml.Diagram.GXDiagram.Model.ModelChange changes.

ModelChangedEventArgs(ModelChangedEventArgs)

This is basically a "copy constructor", making a copy of the given ModelChangedEventArgs.

public ModelChangedEventArgs(ModelChangedEventArgs e)

Parameters

e ModelChangedEventArgs

ModelChangedEventArgs(string, object, object, object)

This constructor initializes the mostly commonly used properties.

public ModelChangedEventArgs(string pname, object data, object oldval, object newval)

Parameters

pname string

the PropertyName property

data object

the Data property

oldval object

the OldValue property

newval object

the NewValue property

Remarks

You may also need to initialize other properties, such as OldParam and NewParam.

Properties

Change

Gets or sets the kind of change that this represents.

public ModelChange Change { get; set; }

Property Value

ModelChange

This is of type StockSharp.Xaml.Diagram.GXDiagram.Model.ModelChange. It defaults to StockSharp.Xaml.Diagram.GXDiagram.Model.ModelChange.Property.

Data

Gets or sets the data object, part of the model, that was modified.

public object Data { get; set; }

Property Value

object

Remarks

Typically this will be either data representing a node or data representing a link.

Model

Gets or sets the IDiagramModel that has been modified.

public IDiagramModel Model { get; set; }

Property Value

IDiagramModel

NewParam

Gets or sets an optional value associated with the new value.

public object NewParam { get; set; }

Property Value

object

NewValue

Gets or sets the next or current value that the property has.

public object NewValue { get; set; }

Property Value

object

OldParam

Gets or sets an optional value associated with the old value.

public object OldParam { get; set; }

Property Value

object

OldValue

Gets or sets the previous or old value that the property had.

public object OldValue { get; set; }

Property Value

object

Methods

CanRedo()

This predicate returns true if you can call Redo().

public bool CanRedo()

Returns

bool

CanUndo()

This predicate returns true if you can call Undo().

public bool CanUndo()

Returns

bool

Clear()

Forget any references that this object may have.

public void Clear()

GetParam(bool)

This is a convenient method to get the right parameter value, depending on the value of undo.

public object GetParam(bool undo)

Parameters

undo bool

Returns

object

either OldParam or NewParam

Remarks

This is useful in implementations of StockSharp.Xaml.Diagram.GXDiagram.Model.IChangeDataValue.ChangeDataValue(StockSharp.Xaml.Diagram.GXDiagram.Model.ModelChangedEventArgs,System.Boolean) or in overrides of StockSharp.Xaml.Diagram.GXDiagram.Model.DiagramModel.ChangeDataValue(StockSharp.Xaml.Diagram.GXDiagram.Model.ModelChangedEventArgs,System.Boolean).

GetValue(bool)

This is a convenient method to get the right value, depending on the value of undo.

public object GetValue(bool undo)

Parameters

undo bool

Returns

object

either OldValue or NewValue

Remarks

This is useful in implementations of StockSharp.Xaml.Diagram.GXDiagram.Model.IChangeDataValue.ChangeDataValue(StockSharp.Xaml.Diagram.GXDiagram.Model.ModelChangedEventArgs,System.Boolean) or in overrides of StockSharp.Xaml.Diagram.GXDiagram.Model.DiagramModel.ChangeDataValue(StockSharp.Xaml.Diagram.GXDiagram.Model.ModelChangedEventArgs,System.Boolean).

Redo()

Re-perform the document change after an Undo() by calling ChangeModel(ModelChangedEventArgs, bool).

public void Redo()

Remarks

CanRedo() must be true for this method to call ChangeModel(ModelChangedEventArgs, bool).

ToString()

Produce a human-readable description of the change to the model.

public override string ToString()

Returns

string

Undo()

Reverse the effects of this document change by calling ChangeModel(ModelChangedEventArgs, bool).

public void Undo()

Remarks

CanUndo() must be true for this method to call ChangeModel(ModelChangedEventArgs, bool).