IDiagramModelAdapter

StockSharp.Xaml.Diagram.Model

Provides a non-generic, UI-independent view over a composition model behavior.

Реализует: IDisposable

Свойства

CanRedo
public bool CanRedo { get; }
value = iDiagramModelAdapter.CanRedo

Gets whether an undone adapter operation can be redone.

CanUndo
public bool CanUndo { get; }
value = iDiagramModelAdapter.CanUndo

Gets whether an adapter operation can be undone.

Model
public ICompositionModel Model { get; }
value = iDiagramModelAdapter.Model

Gets the underlying composition model.

Nodes
public IReadOnlyList<ICompositionModelNode> Nodes { get; }
value = iDiagramModelAdapter.Nodes

Gets a current snapshot of diagram nodes.

Методы

AddElement
public string AddElement(DiagramElement element, PointF location)
result = iDiagramModelAdapter.AddElement(element, location)

Adds an element as one undoable operation.

element
Element to add.
location
Diagram-space location.

Возвращает: New node key.

FindNode
public ICompositionModelNode FindNode(string key)
result = iDiagramModelAdapter.FindNode(key)

Finds a node by its stable model key.

key
Node key.

Возвращает: The node, or when it is absent.

ImportFragmentAsync
public ValueTask<IReadOnlyList<string>> ImportFragmentAsync(ICompositionModel fragment, PointF offset, CancellationToken cancellationToken)
result = iDiagramModelAdapter.ImportFragmentAsync(fragment, offset, cancellationToken)

Imports every node and internal link from a canonical fragment in one transaction.

fragment
Deserialized canonical fragment model.
offset
Coordinate offset.
cancellationToken
CancellationToken

Возвращает: New target node keys.

MoveNodes
public void MoveNodes(IReadOnlyDictionary<string, PointF> originalLocations, PointF delta, double gridSize)
iDiagramModelAdapter.MoveNodes(originalLocations, delta, gridSize)

Moves a group while preserving its relative coordinates and snapping the anchor.

originalLocations
Original locations keyed by node key.
delta
Requested group displacement.
gridSize
Snap grid size, or zero to disable snapping.
Redo
public void Redo()
iDiagramModelAdapter.Redo()

Redoes the last undone adapter operation.

Remove
public void Remove(IEnumerable<string> nodeKeys, IEnumerable<ICompositionModelLink> links)
iDiagramModelAdapter.Remove(nodeKeys, links)

Removes nodes with every link connected to them, and links of their own, in one model transaction that is one step to undo.

nodeKeys
Node keys to remove.
links
Links to remove besides those of the nodes.
SnapDisplacement
public PointF SnapDisplacement(IReadOnlyDictionary<string, PointF> originalLocations, PointF delta, double gridSize)
result = iDiagramModelAdapter.SnapDisplacement(originalLocations, delta, gridSize)

Finds how far a group lands from where it was when its anchor is snapped, as Double) places it.

originalLocations
Original locations keyed by node key.
delta
Requested group displacement.
gridSize
Snap grid size, or zero to disable snapping.

Возвращает: The displacement with the anchor snapped.

TryConnect
public bool TryConnect(string firstNodeKey, string firstSocketId, string secondNodeKey, string secondSocketId, DiagramConnectionResults result)
result = iDiagramModelAdapter.TryConnect(firstNodeKey, firstSocketId, secondNodeKey, secondSocketId, result)

Validates and creates a directed output-to-input connection.

firstNodeKey
First endpoint node key.
firstSocketId
First endpoint socket identifier.
secondNodeKey
Second endpoint node key.
secondSocketId
Second endpoint socket identifier.
result
Connection validation result.

Возвращает: when the connection was created.

Undo
public void Undo()
iDiagramModelAdapter.Undo()

Undoes the last adapter operation.

События

Changed
public event EventHandler Changed
iDiagramModelAdapter.Changed += handler

Occurs after model data relevant to the diagram changes.