public static ConnectedComponentViewModel CreateConnectedComponent(this DesignerViewModel designer, string name, Vector2 position, Vector2 size) { var connectedComponent = new ConnectedComponentViewModel(Guid.NewGuid(), name, position, size); connectedComponent.AddTo(designer); return(connectedComponent); }
public static ConnectionPointViewModel CreateConnectionPoint(this DesignerViewModel designer, ConnectedComponentViewModel connectedComponent) { var newConnectionPoint = new ConnectionPointViewModel(Guid.NewGuid(), connectedComponent); newConnectionPoint.AddTo(designer); return(newConnectionPoint); }
protected override async Task OnInitializedAsync() { var componentBuilder = new ComponentBuilder(); var width = 200; var height = 100; var component1 = new ConnectedComponentViewModel(Rectangle.Create(20, 20, 10, 5)); var component2 = new ConnectedComponentViewModel(Rectangle.Create(40, 40, 10, 5)); var connectionPoint1 = component1.AddConnectionPoint(); var connectionPoint2 = component2.AddConnectionPoint(); var scene = new SceneViewModel(new Vector2(width, height)); var connection = ConnectionViewModel.Connect(scene, connectionPoint1, connectionPoint2); scene.Components.Add(component1); scene.Components.Add(component2); scene.Components.Add(connection); SceneController = new FlowDesignerSceneController(scene); await base.OnInitializedAsync(); }
public bool IsConnectedTo(ConnectedComponentViewModel item) => Point1.Item == item || Point2.Item == item;