Class DiagramElement
The diagram element.
Inheritance
Implements
Inherited Members
Namespace: StockSharp.Xaml.Diagram
Assembly: StockSharp.Xaml.Diagram.dll
Syntax
public abstract class DiagramElement : BaseLogReceiver, IPersistable, ILogReceiver, ILogSource, IDisposable, INotifyPropertyChanging, INotifyPropertyChanged, ICustomTypeDescriptor, INotifyPropertiesChanged
Constructors
DiagramElement()
Initializes a new instance of the DiagramElement.
Declaration
protected DiagramElement()
Properties
CanAutoName
Use auto naming.
Declaration
public bool CanAutoName { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Category
The name of the group which includes a diagram element.
Declaration
public virtual string Category { get; }
Property Value
Type | Description |
---|---|
String |
Connector
Connector.
Declaration
protected IConnector Connector { get; }
Property Value
Type | Description |
---|---|
IConnector |
DebuggerSyncObject
The synchronization object for the debugger.
Declaration
public DebuggerSyncObject DebuggerSyncObject { get; set; }
Property Value
Type | Description |
---|---|
DebuggerSyncObject |
Description
The diagram element description.
Declaration
public virtual string Description { get; }
Property Value
Type | Description |
---|---|
String |
HasUndoManager
Check if undo manager is defined
Declaration
protected bool HasUndoManager { get; }
Property Value
Type | Description |
---|---|
Boolean |
Icon
Icon.
Declaration
public virtual ImageSource Icon { get; }
Property Value
Type | Description |
---|---|
ImageSource |
IconName
Icon resource name.
Declaration
public abstract string IconName { get; }
Property Value
Type | Description |
---|---|
String |
InputSockets
Incoming connections.
Declaration
public IReadOnlyCollection<DiagramSocket> InputSockets { get; }
Property Value
Type | Description |
---|---|
IReadOnlyCollection<DiagramSocket> |
IsUndoRedoing
Whether undo/redo operation is in progress.
Declaration
protected bool IsUndoRedoing { get; }
Property Value
Type | Description |
---|---|
Boolean |
LogLevel
The logging level for the source.
Declaration
public override LogLevels LogLevel { get; set; }
Property Value
Type | Description |
---|---|
LogLevels |
Overrides
Name
The source name.
Declaration
public override string Name { get; set; }
Property Value
Type | Description |
---|---|
String |
Overrides
NeedFlush
Is need flush state (-1 means No).
Declaration
public virtual int NeedFlush { get; }
Property Value
Type | Description |
---|---|
Int32 |
OutputSockets
Outgoing connections.
Declaration
public IReadOnlyCollection<DiagramSocket> OutputSockets { get; }
Property Value
Type | Description |
---|---|
IReadOnlyCollection<DiagramSocket> |
Parameters
Diagram element settings.
Declaration
public virtual IEnumerable<IDiagramElementParam> Parameters { get; }
Property Value
Type | Description |
---|---|
IEnumerable<IDiagramElementParam> |
ParentComposition
Parent composition this element belongs to.
Declaration
public CompositionDiagramElement ParentComposition { get; }
Property Value
Type | Description |
---|---|
CompositionDiagramElement |
ProcessingLevel
Element processing level. How many times Process() is reentered.
Declaration
protected int ProcessingLevel { get; }
Property Value
Type | Description |
---|---|
Int32 |
ProcessNullValues
Process null values.
Declaration
public bool ProcessNullValues { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
ShowParameters
Show element parameters in higher order elements.
Declaration
public bool ShowParameters { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
ShowSockets
Show element sockets in higher order elements.
Declaration
public bool ShowSockets { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Strategy
The strategy to which the element is attached.
Declaration
public virtual DiagramStrategy Strategy { get; set; }
Property Value
Type | Description |
---|---|
DiagramStrategy |
TypeId
The unique identifier of the diagram element type.
Declaration
public abstract Guid TypeId { get; }
Property Value
Type | Description |
---|---|
Guid |
Methods
AddInput(StaticSocketIds, String, DiagramSocketType, Action<DiagramSocketValue>, Int32, Int32, Boolean, Nullable<Boolean>)
To add or get existing incoming connection. isDynamic is false by default.
Declaration
protected DiagramSocket AddInput(StaticSocketIds id, string name, DiagramSocketType type, Action<DiagramSocketValue> process = null, int linkableMax = 1, int index = 2147483647, bool allowConvertToNumeric = false, Nullable<bool> isDynamic = null)
Parameters
Type | Name | Description |
---|---|---|
StaticSocketIds | id | The connection identifier. |
String | name | The connection name. |
DiagramSocketType | type | Connection type. |
Action<DiagramSocketValue> | process | The action is called at the processing of the new incoming value for socket. |
Int32 | linkableMax | The maximum number of connections. |
Int32 | index | Index in sockets list. |
Boolean | allowConvertToNumeric | Allow converting to numeric for input values. |
Nullable<Boolean> | isDynamic | Socket will be saved with the element. Default is true for sockets with explicit id. |
Returns
Type | Description |
---|---|
DiagramSocket | Connection. |
AddInput(String, String, DiagramSocketType, Action<DiagramSocketValue>, Int32, Int32, Boolean, Nullable<Boolean>)
To add or get existing incoming connection. isDynamic is true by default.
Declaration
protected DiagramSocket AddInput(string id, string name, DiagramSocketType type, Action<DiagramSocketValue> process = null, int linkableMax = 1, int index = 2147483647, bool allowConvertToNumeric = false, Nullable<bool> isDynamic = null)
Parameters
Type | Name | Description |
---|---|---|
String | id | The connection identifier. |
String | name | The connection name. |
DiagramSocketType | type | Connection type. |
Action<DiagramSocketValue> | process | The action is called at the processing of the new incoming value for socket. |
Int32 | linkableMax | The maximum number of connections. |
Int32 | index | Index in sockets list. |
Boolean | allowConvertToNumeric | Allow converting to numeric for input values. |
Nullable<Boolean> | isDynamic | Socket will be saved with the element. Default is true for sockets with explicit id. |
Returns
Type | Description |
---|---|
DiagramSocket | Connection. |
AddOutput(StaticSocketIds, String, DiagramSocketType, Int32, Int32, Nullable<Boolean>)
To add or get an outgoing connection.
Declaration
protected DiagramSocket AddOutput(StaticSocketIds id, string name, DiagramSocketType type, int linkableMax = 2147483647, int index = 2147483647, Nullable<bool> isDynamic = null)
Parameters
Type | Name | Description |
---|---|---|
StaticSocketIds | id | The connection identifier. |
String | name | The connection name. |
DiagramSocketType | type | Connection type. |
Int32 | linkableMax | The maximum number of connections. |
Int32 | index | Index in sockets list. |
Nullable<Boolean> | isDynamic | Dynamic sockets are removed during Load(). |
Returns
Type | Description |
---|---|
DiagramSocket | Connection. |
AddOutput(String, String, DiagramSocketType, Int32, Int32, Nullable<Boolean>)
To add or get an outgoing connection.
Declaration
protected DiagramSocket AddOutput(string id, string name, DiagramSocketType type, int linkableMax = 2147483647, int index = 2147483647, Nullable<bool> isDynamic = null)
Parameters
Type | Name | Description |
---|---|---|
String | id | The connection identifier. |
String | name | The connection name. |
DiagramSocketType | type | Connection type. |
Int32 | linkableMax | The maximum number of connections. |
Int32 | index | Index in sockets list. |
Nullable<Boolean> | isDynamic | Dynamic sockets are removed during Load(). |
Returns
Type | Description |
---|---|
DiagramSocket | Connection. |
AddParam(IDiagramElementParam)
To add a parameter.
Declaration
protected void AddParam(IDiagramElementParam param)
Parameters
Type | Name | Description |
---|---|---|
IDiagramElementParam | param | Parameter. |
AddParam<T>(String, T)
To add a parameter.
Declaration
protected DiagramElementParam<T> AddParam<T>(string name, T value = null)
Parameters
Type | Name | Description |
---|---|---|
String | name | Name. |
T | value | Value. |
Returns
Type | Description |
---|---|
DiagramElementParam<T> | Parameter. |
Type Parameters
Name | Description |
---|---|
T | Parameter type. |
ClearSocketValues()
Clear socket values.
Declaration
public virtual void ClearSocketValues()
Clone(Boolean)
Create a copy of DiagramElement.
Declaration
public virtual DiagramElement Clone(bool cloneSockets = true)
Parameters
Type | Name | Description |
---|---|---|
Boolean | cloneSockets | To create copies of connections. |
Returns
Type | Description |
---|---|
DiagramElement | Copy. |
CreateSocketInstance(DiagramSocketDirection, String)
Create new socket instance.
Declaration
protected virtual DiagramSocket CreateSocketInstance(DiagramSocketDirection dir, string socketId = null)
Parameters
Type | Name | Description |
---|---|---|
DiagramSocketDirection | dir | |
String | socketId |
Returns
Type | Description |
---|---|
DiagramSocket |
Flush()
Flush non trigger (root) elements.
Declaration
public virtual void Flush()
GetConnectedSourceSockets(DiagramSocket)
Get connected source sockets.
Declaration
protected DiagramSocket[] GetConnectedSourceSockets(DiagramSocket targetInputSocket)
Parameters
Type | Name | Description |
---|---|---|
DiagramSocket | targetInputSocket |
Returns
Type | Description |
---|---|
DiagramSocket[] |
GetNumConnections(DiagramSocket)
Get connection count.
Declaration
public int GetNumConnections(DiagramSocket socket)
Parameters
Type | Name | Description |
---|---|---|
DiagramSocket | socket | Socket. |
Returns
Type | Description |
---|---|
Int32 | Count. |
GetOrAddInput(StaticSocketIds, String, DiagramSocketType, out Boolean, Action<DiagramSocketValue>, Int32, Int32, Boolean, Nullable<Boolean>)
To add or get existing incoming connection. isDynamic is false by default.
Declaration
protected DiagramSocket GetOrAddInput(StaticSocketIds id, string name, DiagramSocketType type, out bool isNew, Action<DiagramSocketValue> process = null, int linkableMax = 1, int index = 2147483647, bool allowConvertToNumeric = false, Nullable<bool> isDynamic = null)
Parameters
Type | Name | Description |
---|---|---|
StaticSocketIds | id | The connection identifier. |
String | name | The connection name. |
DiagramSocketType | type | Connection type. |
Boolean | isNew | True if this is a new socket. |
Action<DiagramSocketValue> | process | The action is called at the processing of the new incoming value for socket. |
Int32 | linkableMax | The maximum number of connections. |
Int32 | index | Index in sockets list. |
Boolean | allowConvertToNumeric | Allow converting to numeric for input values. |
Nullable<Boolean> | isDynamic | Socket will be saved with the element. Default is true for sockets with explicit id. |
Returns
Type | Description |
---|---|
DiagramSocket | Connection. |
GetOrAddInput(String, String, DiagramSocketType, out Boolean, Action<DiagramSocketValue>, Int32, Int32, Boolean, Nullable<Boolean>)
To add or get existing incoming connection. isDynamic is true by default.
Declaration
protected DiagramSocket GetOrAddInput(string id, string name, DiagramSocketType type, out bool isNew, Action<DiagramSocketValue> process = null, int linkableMax = 1, int index = 2147483647, bool allowConvertToNumeric = false, Nullable<bool> isDynamic = null)
Parameters
Type | Name | Description |
---|---|---|
String | id | The connection identifier. |
String | name | The connection name. |
DiagramSocketType | type | Connection type. |
Boolean | isNew | True if this is a new socket. |
Action<DiagramSocketValue> | process | The action is called at the processing of the new incoming value for socket. |
Int32 | linkableMax | The maximum number of connections. |
Int32 | index | Index in sockets list. |
Boolean | allowConvertToNumeric | Allow converting to numeric for input values. |
Nullable<Boolean> | isDynamic | Socket will be saved with the element. Default is true for sockets with explicit id. |
Returns
Type | Description |
---|---|
DiagramSocket | Connection. |
GetOrAddOutput(StaticSocketIds, String, DiagramSocketType, out Boolean, Int32, Int32, Nullable<Boolean>)
To add or get an outgoing connection. isDynamic is true by default.
Declaration
protected DiagramSocket GetOrAddOutput(StaticSocketIds id, string name, DiagramSocketType type, out bool isNew, int linkableMax = 2147483647, int index = 2147483647, Nullable<bool> isDynamic = null)
Parameters
Type | Name | Description |
---|---|---|
StaticSocketIds | id | The connection identifier. |
String | name | The connection name. |
DiagramSocketType | type | Connection type. |
Boolean | isNew | True if this is a new socket. |
Int32 | linkableMax | The maximum number of connections. |
Int32 | index | Index in sockets list. |
Nullable<Boolean> | isDynamic | Dynamic sockets are removed during Load(). |
Returns
Type | Description |
---|---|
DiagramSocket | Connection. |
GetOrAddOutput(String, String, DiagramSocketType, out Boolean, Int32, Int32, Nullable<Boolean>)
To add or get an outgoing connection.
Declaration
protected DiagramSocket GetOrAddOutput(string id, string name, DiagramSocketType type, out bool isNew, int linkableMax = 2147483647, int index = 2147483647, Nullable<bool> isDynamic = null)
Parameters
Type | Name | Description |
---|---|---|
String | id | The connection identifier. |
String | name | The connection name. |
DiagramSocketType | type | Connection type. |
Boolean | isNew | True if this is a new socket. |
Int32 | linkableMax | The maximum number of connections. |
Int32 | index | Index in sockets list. |
Nullable<Boolean> | isDynamic | Dynamic sockets are removed during Load(). |
Returns
Type | Description |
---|---|
DiagramSocket | Connection. |
Init(ILogSource)
To initialize the element.
Declaration
public void Init(ILogSource parent)
Parameters
Type | Name | Description |
---|---|---|
ILogSource | parent | Parent composition or strategy. |
Load(SettingsStorage)
Load settings.
Declaration
public override void Load(SettingsStorage storage)
Parameters
Type | Name | Description |
---|---|---|
Ecng.Serialization.SettingsStorage | storage | Settings storage. |
Overrides
OnInit()
The method is called at initialization of the diagram element.
Declaration
protected virtual void OnInit()
OnProcess(DateTimeOffset, IDictionary<DiagramSocket, DiagramSocketValue>, DiagramSocketValue)
The method is called at the processing of the new incoming values.
Declaration
protected virtual void OnProcess(DateTimeOffset time, IDictionary<DiagramSocket, DiagramSocketValue> values, DiagramSocketValue source)
Parameters
Type | Name | Description |
---|---|---|
DateTimeOffset | time | Time. |
IDictionary<DiagramSocket, DiagramSocketValue> | values | Values. |
DiagramSocketValue | source | Source value. |
OnReseted()
The method is called at re-initialisation of the diagram element state.
Declaration
protected virtual void OnReseted()
OnSocketConnected(DiagramSocket, DiagramSocket)
The method is called at subscription to the processing of diagram element output values.
Declaration
protected virtual void OnSocketConnected(DiagramSocket socket, DiagramSocket source)
Parameters
Type | Name | Description |
---|---|---|
DiagramSocket | socket | The diagram element socket. |
DiagramSocket | source | The source diagram element socket. |
OnSocketDisconnected(DiagramSocket, DiagramSocket)
The method is called at unsubscription from the processing of diagram element output values.
Declaration
protected virtual void OnSocketDisconnected(DiagramSocket socket, DiagramSocket source)
Parameters
Type | Name | Description |
---|---|---|
DiagramSocket | socket | The diagram element socket. |
DiagramSocket | source | The source diagram element socket. |
OnStart()
The method is called at the start of the diagram element algorithm.
Declaration
protected virtual void OnStart()
OnStop()
The method is called at the stop of the diagram element algorithm.
Declaration
protected virtual void OnStop()
OnUnInit()
The method is called at deinitialization of the diagram element.
Declaration
protected virtual void OnUnInit()
Process(DiagramSocketValue)
To handle the incoming value.
Declaration
public void Process(DiagramSocketValue value)
Parameters
Type | Name | Description |
---|---|---|
DiagramSocketValue | value | Value. |
ProcessDoubleClick(Object)
Process double click event.
Declaration
public virtual bool ProcessDoubleClick(object sender)
Parameters
Type | Name | Description |
---|---|---|
Object | sender | Sender. |
Returns
Type | Description |
---|---|
Boolean |
RaiseParameterValueChanged(String)
To call the ParameterValueChanged event.
Declaration
protected virtual void RaiseParameterValueChanged(string parameterName)
Parameters
Type | Name | Description |
---|---|---|
String | parameterName | Parameter name. |
RaiseProcessOutput(DiagramSocket, DateTimeOffset, Object, DiagramSocketValue, Subscription)
To call the event ProcessOutput.
Declaration
protected void RaiseProcessOutput(DiagramSocket outputSocket, DateTimeOffset time, object value, DiagramSocketValue source, Subscription subscription = null)
Parameters
Type | Name | Description |
---|---|---|
DiagramSocket | outputSocket | Output socket. |
DateTimeOffset | time | Time. |
Object | value | Value. |
DiagramSocketValue | source | Source value. |
Subscription | subscription | Subscription. |
RaiseProcessOutput(DiagramSocket, Object)
To call the event ProcessOutput.
Declaration
protected void RaiseProcessOutput(DiagramSocket outputSocket, object value)
Parameters
Type | Name | Description |
---|---|---|
DiagramSocket | outputSocket | Output socket. |
Object | value | Value. |
RaiseProcessOutput(DiagramSocket, Object, Subscription)
To call the event ProcessOutput.
Declaration
protected void RaiseProcessOutput(DiagramSocket outputSocket, object value, Subscription subscription)
Parameters
Type | Name | Description |
---|---|---|
DiagramSocket | outputSocket | Output socket. |
Object | value | Value. |
Subscription | subscription | Subscription. |
RaiseProcessOutput(DiagramSocket, Object, DiagramSocketValue, Subscription)
To call the event ProcessOutput.
Declaration
protected void RaiseProcessOutput(DiagramSocket outputSocket, object value, DiagramSocketValue source, Subscription subscription = null)
Parameters
Type | Name | Description |
---|---|---|
DiagramSocket | outputSocket | Output socket. |
Object | value | Value. |
DiagramSocketValue | source | Source value. |
Subscription | subscription | Subscription. |
RaiseProcessOutput(DateTimeOffset, Object, DiagramSocketValue, Subscription)
To call the event ProcessOutput.
Declaration
protected void RaiseProcessOutput(DateTimeOffset time, object value, DiagramSocketValue source, Subscription subscription = null)
Parameters
Type | Name | Description |
---|---|---|
DateTimeOffset | time | Time. |
Object | value | Value. |
DiagramSocketValue | source | Source value. |
Subscription | subscription | Subscription. |
RaiseProcessOutput(Object, DiagramSocketValue, Subscription)
To call the event ProcessOutput.
Declaration
protected void RaiseProcessOutput(object value, DiagramSocketValue source, Subscription subscription = null)
Parameters
Type | Name | Description |
---|---|---|
Object | value | Value. |
DiagramSocketValue | source | Source value. |
Subscription | subscription | Subscription. |
RaisePropertiesChanged()
To call the PropertiesChanged event.
Declaration
protected virtual void RaisePropertiesChanged()
RaisePropertyChanged(Object, PropertyChangedEventArgs)
To call the PropertyChanged event.
Declaration
protected virtual void RaisePropertyChanged(object sender, PropertyChangedEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
Object | sender | Sender. |
PropertyChangedEventArgs | args | Arguments. |
RaisePropertyChanged(String)
To call the PropertyChanged event.
Declaration
protected virtual void RaisePropertyChanged(string propertyName)
Parameters
Type | Name | Description |
---|---|---|
String | propertyName | Property name. |
RaisePropertyChanging(Object, PropertyChangingEventArgs)
To call the PropertyChanging event.
Declaration
protected virtual void RaisePropertyChanging(object sender, PropertyChangingEventArgs args)
Parameters
Type | Name | Description |
---|---|---|
Object | sender | Sender. |
PropertyChangingEventArgs | args | Arguments. |
RaisePropertyChanging(String)
To call the PropertyChanging event.
Declaration
protected virtual void RaisePropertyChanging(string propertyName)
Parameters
Type | Name | Description |
---|---|---|
String | propertyName | Property name. |
RaiseSocketChanged(DiagramSocket)
To call the event SocketChanged.
Declaration
protected void RaiseSocketChanged(DiagramSocket socket)
Parameters
Type | Name | Description |
---|---|---|
DiagramSocket | socket | Socket. |
RemoveParam(IDiagramElementParam)
To remove a parameter.
Declaration
protected void RemoveParam(IDiagramElementParam param)
Parameters
Type | Name | Description |
---|---|---|
IDiagramElementParam | param | Parameter. |
RemoveSocket(DiagramSocket)
To remove a connection.
Declaration
protected void RemoveSocket(DiagramSocket socket)
Parameters
Type | Name | Description |
---|---|---|
DiagramSocket | socket | Connection. |
RemoveSocket(String)
To remove a socket by id.
Declaration
protected void RemoveSocket(string socketId)
Parameters
Type | Name | Description |
---|---|---|
String | socketId |
RemoveSockets(Boolean)
To remove all incoming and outgoing connections.
Declaration
protected void RemoveSockets(bool raiseSocketRemoved = true)
Parameters
Type | Name | Description |
---|---|---|
Boolean | raiseSocketRemoved | Raise SocketRemoved event. |
RemoveSockets(Func<DiagramSocket, Boolean>, Boolean)
To remove multiple sockets.
Declaration
protected void RemoveSockets(Func<DiagramSocket, bool> predicate, bool raiseSocketRemoved = true)
Parameters
Type | Name | Description |
---|---|---|
Func<DiagramSocket, Boolean> | predicate | |
Boolean | raiseSocketRemoved | Raise SocketRemoved event. |
Reset()
To reinitialize the diagram element state.
Declaration
public void Reset()
Save(SettingsStorage)
Save settings.
Declaration
public override void Save(SettingsStorage storage)
Parameters
Type | Name | Description |
---|---|---|
Ecng.Serialization.SettingsStorage | storage | Settings storage. |
Overrides
SaveUndoState(Object)
Save state to enable undo.
Declaration
protected IDisposable SaveUndoState(object debugState = null)
Parameters
Type | Name | Description |
---|---|---|
Object | debugState |
Returns
Type | Description |
---|---|
IDisposable |
SetElementName(String)
Set element name.
Declaration
protected void SetElementName(string name)
Parameters
Type | Name | Description |
---|---|---|
String | name | Name. |
Start()
To start the diagram element algorithm.
Declaration
public void Start()
Stop()
To stop the diagram element algorithm.
Declaration
public void Stop()
UnInit()
The deinitialization of the element.
Declaration
public void UnInit()
Events
CommittedUndoableOperation
Committed undoable operation.
Declaration
public event Action<DiagramElement, IUndoableEdit> CommittedUndoableOperation
Event Type
Type | Description |
---|---|
Action<DiagramElement, IUndoableEdit> |
ParameterValueChanged
The diagram element parameter value change event.
Declaration
public event Action<string> ParameterValueChanged
Event Type
Type | Description |
---|---|
Action<String> |
ProcessOutput
New data occurring event.
Declaration
public event Action<DiagramSocketValue> ProcessOutput
Event Type
Type | Description |
---|---|
Action<DiagramSocketValue> |
PropertiesChanged
The available properties change event.
Declaration
public event Action PropertiesChanged
Event Type
Type | Description |
---|---|
Action |
PropertyChanged
The diagram element properties value change event.
Declaration
public event PropertyChangedEventHandler PropertyChanged
Event Type
Type | Description |
---|---|
PropertyChangedEventHandler |
PropertyChanging
The diagram element properties value changing event.
Declaration
public event PropertyChangingEventHandler PropertyChanging
Event Type
Type | Description |
---|---|
PropertyChangingEventHandler |
SocketAdded
The diagram element connection added event.
Declaration
public event Action<DiagramSocket> SocketAdded
Event Type
Type | Description |
---|---|
Action<DiagramSocket> |
SocketChanged
The diagram element connection changed event.
Declaration
public event Action<DiagramSocket> SocketChanged
Event Type
Type | Description |
---|---|
Action<DiagramSocket> |
SocketRemoved
The diagram element connection removed event.
Declaration
public event Action<DiagramSocket> SocketRemoved
Event Type
Type | Description |
---|---|
Action<DiagramSocket> |
StartedUndoableOperation
Started undoable operation.
Declaration
public event Action StartedUndoableOperation
Event Type
Type | Description |
---|---|
Action |