/// <summary> /// Adds an object port to the node /// </summary> /// <param name="node"></param> /// <param name="text">Title of the port</param> /// <param name="porttype">Type of the port (Input,Output)</param> /// <param name="type">Type of the data of the port</param> /// <para name="multicon">Multiple connections in one port</para> /// <param name="multiconnections"></param> /// <param name="control">The control that will host the data <c>optional</c></param> public void AddObjectPort(Node node, string text, PortTypes porttype, RTypes type, bool multiconnections, Control control) { var port = new ObjectPort(Host, porttype, text, type) { Control = control, MultipleConnectionsAllowed = multiconnections, ParentNode = this }; if (port.PortTypes == PortTypes.Input) { port.Style = (Style)FindResource("InObjectPortStyle"); port.index = InputPorts.Count; InputPorts.Add(port); } else { port.Style = (Style)FindResource("OutObjectPortStyle"); port.index = OutputPorts.Count; OutputPorts.Add(port); } }
public ObjectsConnector(VirtualControl host, ObjectPort sPort, ObjectPort ePort) : base(host, sPort, ePort) { Wire.Background = sPort.StrokeBrush; Host = host; Type = ConnectorTypes.Object; StartPort = sPort; ePort.Linked = true; sPort.Linked = true; EndPort = ePort; StartPort.CalcOrigin(); EndPort.CalcOrigin(); Sp = PointsCalculator.PortOrigin(StartPort); Ep = PointsCalculator.PortOrigin(EndPort); Wire.StartPoint = Sp; Wire.EndPoint = Ep; ePort.Linked = true; sPort.Linked = true; Host.Children.Add(Wire); sPort.ParentNode.PropertyChanged += ParentNodeOnPropertyChanged; ePort.ParentNode.PropertyChanged += ParentNodeOnPropertyChanged; ePort.Data.Value = sPort.Data.Value; StartPort = sPort; EndPort = ePort; Wire.ContextMenu = wireMenu(); }
public void AddObjectPort(Node node, string text, PortTypes porttype, RTypes type, bool multiconnections) { var port = new ObjectPort(Host, porttype, text, type) { MultipleConnectionsAllowed = multiconnections }; port.ParentNode = node; if (port.PortTypes == PortTypes.Input) { InputPorts?.Add(port); InputPortsPanel?.Children.Add(port); } else { OutputPorts?.Add(port); OutputPortsPanel?.Children.Add(port); } OnPropertyChanged(); }