Add Mechanism to be used as visual programming
Closed this issue · 8 comments
Add mechanism to build a syntax tree from the nodes to execute directly or compile to a binary
Can you provide example of expected api for syntax trees?
Maybe something like add a method to INode:
object Translate()
Maybe something like add a method to INode:
object Translate()
Sorry but that doesn't tell me much and you can do that just by inheriting from default node view model. Do you know of any libraries that do that can be commercial or open source.
I have seen a lib for WPF that can execute the node but I have forgot the name
How could I get the connected Pins from the viewmodel?
How could I get the connected Pins from the viewmodel?
@furesoft No built-in method, check Parent
property of INode
for IDrawingNode
type and it has all connectors in Connectors
property, from there find all connectors that have Pins
in your node. From that you can build your connection graph.
Could you provide a Sample in the sample app?
public void PrintNetList(IDrawingNode? drawing)
{
if (drawing?.Connectors is null || drawing?.Nodes is null)
{
return;
}
foreach (var connector in drawing.Connectors)
{
if (connector.Start is { } start && connector.End is { } end)
{
Debug.WriteLine($"{start.Parent?.Name}:{start.Name} -> {end.Parent?.Name}:{end.Name}");
}
}
}