Table of Contents

Class DiagramElement

Namespace
StockSharp.Diagram
Assembly
StockSharp.Diagram.Core.dll

The diagram element.

public abstract class DiagramElement : BaseLogReceiver, ILogReceiver, ILogSource, IDisposable, INotifyPropertyChanging, INotifyPropertyChanged, ICustomTypeDescriptor, INotifyPropertiesChanged, IPersistable
Inheritance
DiagramElement
Implements
INotifyPropertiesChanged
IPersistable
Derived
Inherited Members
Extension Methods

Constructors

DiagramElement()

Initializes a new instance of the DiagramElement.

protected DiagramElement()

Fields

FlushDisabled

Disabled value for FlushPriority.

protected const int FlushDisabled = -1

Field Value

int

FlushNormal

Normal value for FlushPriority.

protected const int FlushNormal = 0

Field Value

int

Properties

CanAutoName

Use auto naming.

public bool CanAutoName { get; set; }

Property Value

bool

Category

The name of the group which includes a diagram element.

public virtual string Category { get; }

Property Value

string

Connector

Connector.

protected IConnector Connector { get; }

Property Value

IConnector

DebuggerSyncObject

The synchronization object for the debugger.

public DebuggerSyncObject DebuggerSyncObject { get; set; }

Property Value

DebuggerSyncObject

Description

The diagram element description.

public virtual string Description { get; }

Property Value

string

Dispatcher

Ecng.ComponentModel.IDispatcher.

protected virtual IDispatcher Dispatcher { get; }

Property Value

IDispatcher

DocUrl

Help url.

public virtual string DocUrl { get; set; }

Property Value

string

FlushPriority

Is need flush state (FlushDisabled means No).

public int FlushPriority { get; protected set; }

Property Value

int

HasUndoManager

Check if undo manager is defined

public virtual bool HasUndoManager { get; }

Property Value

bool

IconName

Icon resource name.

[Browsable(false)]
public abstract string IconName { get; }

Property Value

string

InputSockets

Incoming connections.

[Browsable(false)]
public IReadOnlyCollection<DiagramSocket> InputSockets { get; }

Property Value

IReadOnlyCollection<DiagramSocket>

IsExternalCode

Is the element contains external code.

public virtual bool IsExternalCode { get; }

Property Value

bool

IsUndoRedoing

Whether undo/redo operation is in progress.

public virtual bool IsUndoRedoing { get; }

Property Value

bool

LogLevel

The logging level for the source.

public override LogLevels LogLevel { get; set; }

Property Value

LogLevels

Name

The source name.

public override string Name { get; set; }

Property Value

string

OutputSockets

Outgoing connections.

[Browsable(false)]
public IReadOnlyCollection<DiagramSocket> OutputSockets { get; }

Property Value

IReadOnlyCollection<DiagramSocket>

Parameters

Diagram element settings.

[Browsable(false)]
public virtual IEnumerable<IDiagramElementParam> Parameters { get; }

Property Value

IEnumerable<IDiagramElementParam>

ParentComposition

Parent composition this element belongs to.

public CompositionDiagramElement ParentComposition { get; }

Property Value

CompositionDiagramElement

ProcessNullValues

Process null values.

public bool ProcessNullValues { get; set; }

Property Value

bool

ProcessingLevel

Element processing level. How many times Process(DiagramSocketValue) is reentered.

protected int ProcessingLevel { get; }

Property Value

int

PropVersion

Helper version to update prop grid UI.

public int PropVersion { get; set; }

Property Value

int

ShowParameters

Show element parameters in higher order elements.

public bool ShowParameters { get; set; }

Property Value

bool

ShowSockets

Show element sockets in higher order elements.

public bool ShowSockets { get; set; }

Property Value

bool

Strategy

The strategy to which the element is attached.

public virtual DiagramStrategy Strategy { get; set; }

Property Value

DiagramStrategy

TypeId

The unique identifier of the diagram element type.

public abstract Guid TypeId { get; }

Property Value

Guid

Methods

AddInput(StaticSocketIds, string, DiagramSocketType, Action<DiagramSocketValue>, int, int, bool?)

To add or get existing incoming connection. isDynamic is false by default.

protected DiagramSocket AddInput(StaticSocketIds id, string name, DiagramSocketType type, Action<DiagramSocketValue> process = null, int linkableMax = 1, int index = 2147483647, bool? isDynamic = null)

Parameters

id StaticSocketIds

The connection identifier.

name string

The connection name.

type DiagramSocketType

Connection type.

process Action<DiagramSocketValue>

The action is called at the processing of the new incoming value for socket.

linkableMax int

The maximum number of connections.

index int

Index in sockets list.

isDynamic bool?

Socket will be saved with the element. Default is true for sockets with explicit id.

Returns

DiagramSocket

Connection.

AddInput(string, string, DiagramSocketType, Action<DiagramSocketValue>, int, int, bool?)

To add or get existing incoming connection. isDynamic is true by default.

protected DiagramSocket AddInput(string id, string name, DiagramSocketType type, Action<DiagramSocketValue> process = null, int linkableMax = 1, int index = 2147483647, bool? isDynamic = null)

Parameters

id string

The connection identifier.

name string

The connection name.

type DiagramSocketType

Connection type.

process Action<DiagramSocketValue>

The action is called at the processing of the new incoming value for socket.

linkableMax int

The maximum number of connections.

index int

Index in sockets list.

isDynamic bool?

Socket will be saved with the element. Default is true for sockets with explicit id.

Returns

DiagramSocket

Connection.

AddOutput(StaticSocketIds, string, DiagramSocketType, int, int, bool)

To add or get an outgoing connection.

protected DiagramSocket AddOutput(StaticSocketIds id, string name, DiagramSocketType type, int linkableMax = 2147483647, int index = 2147483647, bool isDynamic = false)

Parameters

id StaticSocketIds

The connection identifier.

name string

The connection name.

type DiagramSocketType

Connection type.

linkableMax int

The maximum number of connections.

index int

Index in sockets list.

isDynamic bool

Dynamic sockets are removed during Load().

Returns

DiagramSocket

Connection.

AddOutput(string, string, DiagramSocketType, int, int, bool)

To add or get an outgoing connection.

protected DiagramSocket AddOutput(string id, string name, DiagramSocketType type, int linkableMax = 2147483647, int index = 2147483647, bool isDynamic = true)

Parameters

id string

The connection identifier.

name string

The connection name.

type DiagramSocketType

Connection type.

linkableMax int

The maximum number of connections.

index int

Index in sockets list.

isDynamic bool

Dynamic sockets are removed during Load().

Returns

DiagramSocket

Connection.

AddParam(IDiagramElementParam)

To add a parameter.

protected void AddParam(IDiagramElementParam param)

Parameters

param IDiagramElementParam

Parameter.

AddParam<T>(string, T)

To add a parameter.

protected DiagramElementParam<T> AddParam<T>(string name, T value = default)

Parameters

name string

Name.

value T

Value.

Returns

DiagramElementParam<T>

Parameter.

Type Parameters

T

Parameter type.

ClearSocketValues()

Clear socket values.

public virtual void ClearSocketValues()

Clone(bool)

Create a copy of DiagramElement.

public virtual DiagramElement Clone(bool cloneSockets = true)

Parameters

cloneSockets bool

To create copies of connections.

Returns

DiagramElement

Copy.

CreateSocketInstance(DiagramSocketDirection, string)

Create new socket instance.

protected virtual DiagramSocket CreateSocketInstance(DiagramSocketDirection dir, string socketId = null)

Parameters

dir DiagramSocketDirection
socketId string

Returns

DiagramSocket

DisposeManaged()

protected override void DisposeManaged()

Flush(DateTimeOffset)

Flush non trigger (root) elements.

public virtual void Flush(DateTimeOffset time)

Parameters

time DateTimeOffset

GenerateSocketId(string)

Generate socket identifier.

public static string GenerateSocketId(string suffix)

Parameters

suffix string

Suffix.

Returns

string

Identifier.

GetCategory()

Get category.

public virtual string GetCategory()

Returns

string

Category.

GetCloneType()

Get type for cloning.

protected virtual Type GetCloneType()

Returns

Type

GetConnectedSourceSockets(DiagramSocket)

Get connected source sockets.

public DiagramSocket[] GetConnectedSourceSockets(DiagramSocket targetInputSocket)

Parameters

targetInputSocket DiagramSocket

Returns

DiagramSocket[]

GetDescription()

Get description.

public virtual string GetDescription()

Returns

string

Description.

GetDisplayName()

Get display name.

public virtual string GetDisplayName()

Returns

string

Name.

GetNumConnections(DiagramSocket)

Get connection count.

public int GetNumConnections(DiagramSocket socket)

Parameters

socket DiagramSocket

Socket.

Returns

int

Count.

GetOrAddSocket(string, DiagramSocketDirection, string, DiagramSocketType, Action<DiagramSocketValue>, int, int, bool, bool)

To add or get an outgoing connection.

protected (DiagramSocket socket, bool isNew) GetOrAddSocket(string socketId, DiagramSocketDirection dir, string name, DiagramSocketType type, Action<DiagramSocketValue> process, int linkableMax, int index, bool isDynamic, bool allowGet)

Parameters

socketId string

The connection identifier.

dir DiagramSocketDirection

DiagramSocketDirection

name string

The connection name.

type DiagramSocketType

Connection type.

process Action<DiagramSocketValue>

The action is called at the processing of the new incoming value for socket.

linkableMax int

The maximum number of connections.

index int

Index in sockets list.

isDynamic bool

Dynamic sockets are removed during Load(SettingsStorage).

allowGet bool

Return existing socket if it's already exist.

Returns

(DiagramSocket socket, bool isNew)

Connection.

Init(ILogSource)

To initialize the element.

public void Init(ILogSource parent)

Parameters

parent ILogSource

Parent composition or strategy.

InitializeCopy(DiagramElement)

public virtual void InitializeCopy(DiagramElement copiedFrom)

Parameters

copiedFrom DiagramElement

Load(SettingsStorage)

Load settings.

public override void Load(SettingsStorage storage)

Parameters

storage SettingsStorage

Settings storage.

OnInit()

The method is called at initialization of the diagram element.

protected virtual void OnInit()

OnPrepare()

To prepare for starting the diagram element algorithm.

protected virtual void OnPrepare()

OnProcess(DateTimeOffset, IDictionary<DiagramSocket, DiagramSocketValue>, DiagramSocketValue)

The method is called at the processing of the new incoming values.

protected virtual void OnProcess(DateTimeOffset time, IDictionary<DiagramSocket, DiagramSocketValue> values, DiagramSocketValue source)

Parameters

time DateTimeOffset

Time.

values IDictionary<DiagramSocket, DiagramSocketValue>

Values.

source DiagramSocketValue

Source value.

OnReseted()

The method is called at re-initialisation of the diagram element state.

protected virtual void OnReseted()

OnSocketConnected(DiagramSocket, DiagramSocket)

The method is called at subscription to the processing of diagram element output values.

protected virtual void OnSocketConnected(DiagramSocket socket, DiagramSocket source)

Parameters

socket DiagramSocket

The diagram element socket.

source DiagramSocket

The source diagram element socket.

OnSocketDisconnected(DiagramSocket, DiagramSocket)

The method is called at unsubscription from the processing of diagram element output values.

protected virtual void OnSocketDisconnected(DiagramSocket socket, DiagramSocket source)

Parameters

socket DiagramSocket

The diagram element socket.

source DiagramSocket

The source diagram element socket.

OnStart(DateTimeOffset)

The method is called at the start of the diagram element algorithm.

protected virtual void OnStart(DateTimeOffset time)

Parameters

time DateTimeOffset

OnStop()

The method is called at the stop of the diagram element algorithm.

protected virtual void OnStop()

OnUnInit()

The method is called at deinitialization of the diagram element.

protected virtual void OnUnInit()

Prepare()

To prepare for starting the diagram element algorithm.

public void Prepare()

Process(DiagramSocketValue)

To handle the incoming value.

public void Process(DiagramSocketValue value)

Parameters

value DiagramSocketValue

Value.

RaiseParameterValueChanged(string)

To call the ParameterValueChanged event.

protected virtual void RaiseParameterValueChanged(string parameterName)

Parameters

parameterName string

Parameter name.

RaiseProcessOutput(DiagramSocket, DateTimeOffset, object, DiagramSocketValue, Subscription)

To call the event ProcessOutput.

protected void RaiseProcessOutput(DiagramSocket socket, DateTimeOffset time, object value, DiagramSocketValue source = null, Subscription subscription = null)

Parameters

socket DiagramSocket

Output socket.

time DateTimeOffset

Time.

value object

Value.

source DiagramSocketValue

Source value.

subscription Subscription

Subscription.

RaisePropertiesChanged()

To call the PropertiesChanged event.

protected virtual void RaisePropertiesChanged()

RaisePropertyChanged(object, PropertyChangedEventArgs)

To call the PropertyChanged event.

protected virtual void RaisePropertyChanged(object sender, PropertyChangedEventArgs args)

Parameters

sender object

Sender.

args PropertyChangedEventArgs

Arguments.

RaisePropertyChanged(string)

To call the PropertyChanged event.

protected virtual void RaisePropertyChanged(string propertyName)

Parameters

propertyName string

Property name.

RaisePropertyChanging(object, PropertyChangingEventArgs)

To call the PropertyChanging event.

protected virtual void RaisePropertyChanging(object sender, PropertyChangingEventArgs args)

Parameters

sender object

Sender.

args PropertyChangingEventArgs

Arguments.

RaisePropertyChanging(string)

To call the PropertyChanging event.

protected virtual void RaisePropertyChanging(string propertyName)

Parameters

propertyName string

Property name.

RaiseSocketChanged(DiagramSocket)

To call the event SocketChanged.

protected void RaiseSocketChanged(DiagramSocket socket)

Parameters

socket DiagramSocket

Socket.

RemoveParam(IDiagramElementParam)

To remove a parameter.

protected void RemoveParam(IDiagramElementParam param)

Parameters

param IDiagramElementParam

Parameter.

RemoveSocket(DiagramSocket)

To remove a connection.

protected void RemoveSocket(DiagramSocket socket)

Parameters

socket DiagramSocket

Connection.

RemoveSockets(bool)

To remove all incoming and outgoing connections.

protected virtual void RemoveSockets(bool raiseSocketRemoved = true)

Parameters

raiseSocketRemoved bool

Raise SocketRemoved event.

RemoveSockets(Func<DiagramSocket, bool>, bool)

To remove multiple sockets.

protected void RemoveSockets(Func<DiagramSocket, bool> predicate, bool raiseSocketRemoved = true)

Parameters

predicate Func<DiagramSocket, bool>
raiseSocketRemoved bool

Raise SocketRemoved event.

Reset()

To reinitialize the diagram element state.

public void Reset()

ResetFlushPriority()

protected void ResetFlushPriority()

Save(SettingsStorage)

Save settings.

public override void Save(SettingsStorage storage)

Parameters

storage SettingsStorage

Settings storage.

SaveUndoState(object)

Save state to enable undo.

protected IDisposable SaveUndoState(object debugState = null)

Parameters

debugState object

Returns

IDisposable

SetElementName(string)

Set element name.

protected void SetElementName(string name)

Parameters

name string

Name.

Start(DateTimeOffset)

To start for start the diagram element algorithm.

public void Start(DateTimeOffset time)

Parameters

time DateTimeOffset

Stop()

To stop the diagram element algorithm.

public void Stop()

UnInit()

The deinitialization of the element.

public void UnInit()

Events

CommittedUndoableOperation

Committed undoable operation.

public event Action<DiagramElement, IUndoableEdit> CommittedUndoableOperation

Event Type

Action<DiagramElement, IUndoableEdit>

ParameterValueChanged

The diagram element parameter value change event.

public event Action<string> ParameterValueChanged

Event Type

Action<string>

ProcessOutput

New data occurring event.

public event Action<DiagramSocketValue> ProcessOutput

Event Type

Action<DiagramSocketValue>

PropertiesChanged

The available properties change event.

public event Action PropertiesChanged

Event Type

Action

PropertyChanged

The diagram element properties value change event.

public event PropertyChangedEventHandler PropertyChanged

Event Type

PropertyChangedEventHandler

PropertyChanging

The diagram element properties value changing event.

public event PropertyChangingEventHandler PropertyChanging

Event Type

PropertyChangingEventHandler

SocketAdded

The diagram element connection added event.

public event Action<DiagramSocket> SocketAdded

Event Type

Action<DiagramSocket>

SocketChanged

The diagram element connection changed event.

public event Action<DiagramSocket> SocketChanged

Event Type

Action<DiagramSocket>

SocketRemoved

The diagram element connection removed event.

public event Action<DiagramSocket> SocketRemoved

Event Type

Action<DiagramSocket>

StartedUndoableOperation

Started undoable operation.

public event Action StartedUndoableOperation

Event Type

Action