Files
StockSharp/Diagram.Core/ICompositionModelLink.cs
T
mika@stocksharp.com 776f1f7eec Diagram.Core: de-stub the in-memory composition behavior and rename Dummy to InMemory
Productionize the in-memory composition model behavior:
- Assign a key to nodes added through the behavior (a null-key node crashed the
  diagram panel rendering on add/load).
- De-stub the three UI hooks (RaiseSocketAdded/RaiseLinksRemoved/RaiseCommited)
  that previously threw NotSupportedException so they raise BehaviorChanged like
  the WPF model, and rename DummyCompositionModelBehavior/Node/Link to
  InMemoryCompositionModelBehavior/Node/Link.

Note: the rename is a breaking change to public types in the published
StockSharp.Diagram.Core package; in-workspace consumers all build from source.
2026-06-06 16:07:41 +03:00

66 lines
1.3 KiB
C#

namespace StockSharp.Diagram;
/// <summary>
/// Link.
/// </summary>
public interface ICompositionModelLink : ICloneable
{
/// <summary>
/// Is reconnecting.
/// </summary>
bool IsReconnecting { get; set; }
/// <summary>
/// Is connected.
/// </summary>
bool IsConnected { get; set; }
/// <summary>
/// From node key.
/// </summary>
string From { get; set; }
/// <summary>
/// To node key.
/// </summary>
string To { get; set; }
/// <summary>
/// To socket key.
/// </summary>
string ToPort { get; set; }
/// <summary>
/// From socket key.
/// </summary>
string FromPort { get; set; }
}
/// <summary>
/// In-memory implementation of <see cref="ICompositionModelLink"/>.
/// </summary>
public class InMemoryCompositionModelLink : ICompositionModelLink
{
bool ICompositionModelLink.IsReconnecting { get; set; }
bool ICompositionModelLink.IsConnected { get; set; }
/// <inheritdoc/>
public string From { get; set; }
/// <inheritdoc/>
public string To { get; set; }
/// <inheritdoc/>
public string ToPort { get; set; }
/// <inheritdoc/>
public string FromPort { get; set; }
object ICloneable.Clone() => new InMemoryCompositionModelLink
{
From = From,
To = To,
FromPort = FromPort,
ToPort = ToPort,
};
/// <inheritdoc/>
public override string ToString() => $"{From}({FromPort}) -> {To}({ToPort})";
}