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
-
INotifyPropertiesChangedIPersistable
- 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
FlushNormal
Normal value for FlushPriority.
protected const int FlushNormal = 0
Field Value
Properties
CanAutoName
Use auto naming.
public bool CanAutoName { get; set; }
Property Value
Category
The name of the group which includes a diagram element.
public virtual string Category { get; }
Property Value
Connector
Connector.
protected IConnector Connector { get; }
Property Value
DebuggerSyncObject
The synchronization object for the debugger.
public DebuggerSyncObject DebuggerSyncObject { get; set; }
Property Value
Description
The diagram element description.
public virtual string Description { get; }
Property Value
Dispatcher
Ecng.ComponentModel.IDispatcher.
protected virtual IDispatcher Dispatcher { get; }
Property Value
- IDispatcher
DocUrl
Help url.
public virtual string DocUrl { get; set; }
Property Value
FlushPriority
Is need flush state (FlushDisabled means No).
public int FlushPriority { get; protected set; }
Property Value
HasUndoManager
Check if undo manager is defined
public virtual bool HasUndoManager { get; }
Property Value
IconName
Icon resource name.
[Browsable(false)]
public abstract string IconName { get; }
Property Value
InputSockets
Incoming connections.
[Browsable(false)]
public IReadOnlyCollection<DiagramSocket> InputSockets { get; }
Property Value
IsExternalCode
Is the element contains external code.
public virtual bool IsExternalCode { get; }
Property Value
IsUndoRedoing
Whether undo/redo operation is in progress.
public virtual bool IsUndoRedoing { get; }
Property Value
LogLevel
The logging level for the source.
public override LogLevels LogLevel { get; set; }
Property Value
Name
The source name.
public override string Name { get; set; }
Property Value
OutputSockets
Outgoing connections.
[Browsable(false)]
public IReadOnlyCollection<DiagramSocket> OutputSockets { get; }
Property Value
Parameters
Diagram element settings.
[Browsable(false)]
public virtual IEnumerable<IDiagramElementParam> Parameters { get; }
Property Value
ParentComposition
Parent composition this element belongs to.
public CompositionDiagramElement ParentComposition { get; }
Property Value
ProcessNullValues
Process null values.
public bool ProcessNullValues { get; set; }
Property Value
ProcessingLevel
Element processing level. How many times Process(DiagramSocketValue) is reentered.
protected int ProcessingLevel { get; }
Property Value
PropVersion
Helper version to update prop grid UI.
public int PropVersion { get; set; }
Property Value
ShowParameters
Show element parameters in higher order elements.
public bool ShowParameters { get; set; }
Property Value
ShowSockets
Show element sockets in higher order elements.
public bool ShowSockets { get; set; }
Property Value
Strategy
The strategy to which the element is attached.
public virtual DiagramStrategy Strategy { get; set; }
Property Value
TypeId
The unique identifier of the diagram element type.
public abstract Guid TypeId { get; }
Property Value
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
StaticSocketIdsThe connection identifier.
name
stringThe connection name.
type
DiagramSocketTypeConnection type.
process
Action<DiagramSocketValue>The action is called at the processing of the new incoming value for socket.
linkableMax
intThe maximum number of connections.
index
intIndex 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
stringThe connection identifier.
name
stringThe connection name.
type
DiagramSocketTypeConnection type.
process
Action<DiagramSocketValue>The action is called at the processing of the new incoming value for socket.
linkableMax
intThe maximum number of connections.
index
intIndex 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
StaticSocketIdsThe connection identifier.
name
stringThe connection name.
type
DiagramSocketTypeConnection type.
linkableMax
intThe maximum number of connections.
index
intIndex in sockets list.
isDynamic
boolDynamic 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
stringThe connection identifier.
name
stringThe connection name.
type
DiagramSocketTypeConnection type.
linkableMax
intThe maximum number of connections.
index
intIndex in sockets list.
isDynamic
boolDynamic sockets are removed during Load().
Returns
- DiagramSocket
Connection.
AddParam(IDiagramElementParam)
To add a parameter.
protected void AddParam(IDiagramElementParam param)
Parameters
param
IDiagramElementParamParameter.
AddParam<T>(string, T)
To add a parameter.
protected DiagramElementParam<T> AddParam<T>(string name, T value = default)
Parameters
name
stringName.
value
TValue.
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
boolTo 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
DiagramSocketDirectionsocketId
string
Returns
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
stringSuffix.
Returns
- string
Identifier.
GetCategory()
Get category.
public virtual string GetCategory()
Returns
- string
Category.
GetCloneType()
Get type for cloning.
protected virtual Type GetCloneType()
Returns
GetConnectedSourceSockets(DiagramSocket)
Get connected source sockets.
public DiagramSocket[] GetConnectedSourceSockets(DiagramSocket targetInputSocket)
Parameters
targetInputSocket
DiagramSocket
Returns
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
DiagramSocketSocket.
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
stringThe connection identifier.
dir
DiagramSocketDirectionname
stringThe connection name.
type
DiagramSocketTypeConnection type.
process
Action<DiagramSocketValue>The action is called at the processing of the new incoming value for socket.
linkableMax
intThe maximum number of connections.
index
intIndex in sockets list.
isDynamic
boolDynamic sockets are removed during Load(SettingsStorage).
allowGet
boolReturn 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
ILogSourceParent 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
SettingsStorageSettings 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
DateTimeOffsetTime.
values
IDictionary<DiagramSocket, DiagramSocketValue>Values.
source
DiagramSocketValueSource 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
DiagramSocketThe diagram element socket.
source
DiagramSocketThe 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
DiagramSocketThe diagram element socket.
source
DiagramSocketThe 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
DiagramSocketValueValue.
RaiseParameterValueChanged(string)
To call the ParameterValueChanged event.
protected virtual void RaiseParameterValueChanged(string parameterName)
Parameters
parameterName
stringParameter 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
DiagramSocketOutput socket.
time
DateTimeOffsetTime.
value
objectValue.
source
DiagramSocketValueSource value.
subscription
SubscriptionSubscription.
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
objectSender.
args
PropertyChangedEventArgsArguments.
RaisePropertyChanged(string)
To call the PropertyChanged event.
protected virtual void RaisePropertyChanged(string propertyName)
Parameters
propertyName
stringProperty name.
RaisePropertyChanging(object, PropertyChangingEventArgs)
To call the PropertyChanging event.
protected virtual void RaisePropertyChanging(object sender, PropertyChangingEventArgs args)
Parameters
sender
objectSender.
args
PropertyChangingEventArgsArguments.
RaisePropertyChanging(string)
To call the PropertyChanging event.
protected virtual void RaisePropertyChanging(string propertyName)
Parameters
propertyName
stringProperty name.
RaiseSocketChanged(DiagramSocket)
To call the event SocketChanged.
protected void RaiseSocketChanged(DiagramSocket socket)
Parameters
socket
DiagramSocketSocket.
RemoveParam(IDiagramElementParam)
To remove a parameter.
protected void RemoveParam(IDiagramElementParam param)
Parameters
param
IDiagramElementParamParameter.
RemoveSocket(DiagramSocket)
To remove a connection.
protected void RemoveSocket(DiagramSocket socket)
Parameters
socket
DiagramSocketConnection.
RemoveSockets(bool)
To remove all incoming and outgoing connections.
protected virtual void RemoveSockets(bool raiseSocketRemoved = true)
Parameters
raiseSocketRemoved
boolRaise 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
boolRaise SocketRemoved event.
Reset()
To reinitialize the diagram element state.
public void Reset()
ResetFlushPriority()
Reset FlushPriority.
protected void ResetFlushPriority()
Save(SettingsStorage)
Save settings.
public override void Save(SettingsStorage storage)
Parameters
storage
SettingsStorageSettings storage.
SaveUndoState(object)
Save state to enable undo.
protected IDisposable SaveUndoState(object debugState = null)
Parameters
debugState
object
Returns
SetElementName(string)
Set element name.
protected void SetElementName(string name)
Parameters
name
stringName.
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
ParameterValueChanged
The diagram element parameter value change event.
public event Action<string> ParameterValueChanged
Event Type
ProcessOutput
New data occurring event.
public event Action<DiagramSocketValue> ProcessOutput
Event Type
PropertiesChanged
The available properties change event.
public event Action PropertiesChanged
Event Type
PropertyChanged
The diagram element properties value change event.
public event PropertyChangedEventHandler PropertyChanged
Event Type
PropertyChanging
The diagram element properties value changing event.
public event PropertyChangingEventHandler PropertyChanging
Event Type
SocketAdded
The diagram element connection added event.
public event Action<DiagramSocket> SocketAdded
Event Type
SocketChanged
The diagram element connection changed event.
public event Action<DiagramSocket> SocketChanged
Event Type
SocketRemoved
The diagram element connection removed event.
public event Action<DiagramSocket> SocketRemoved
Event Type
StartedUndoableOperation
Started undoable operation.
public event Action StartedUndoableOperation