public void DisconnectView(BaseConnectionView edgeView) { BasePortView inputPortView = edgeView.input as BasePortView; BaseNodeView inputNodeView = inputPortView.node as BaseNodeView; if (inputPortView != null) { inputPortView.Disconnect(edgeView); } inputPortView.Disconnect(edgeView); BasePortView outputPortView = edgeView.output as BasePortView; BaseNodeView outputNodeView = outputPortView.node as BaseNodeView; if (outputPortView != null) { outputPortView.Disconnect(edgeView); } outputPortView.Disconnect(edgeView); inputNodeView.RefreshPorts(); outputNodeView.RefreshPorts(); RemoveElement(edgeView); }
public BaseNodeView AddNodeView(BaseNode node) { Type nodeViewType = GetNodeViewType(node); BaseNodeView nodeView = Activator.CreateInstance(nodeViewType) as BaseNodeView; nodeView.SetUp(node, this); NodeViews[node.GUID] = nodeView; AddElement(nodeView); return(nodeView); }
public BaseConnectionView ConnectView(BaseNodeView from, BaseNodeView to, BaseConnection connection) { var edgeView = Activator.CreateInstance(GetConnectionViewType(connection), true) as BaseConnectionView; edgeView.SetUp(connection, this); edgeView.userData = connection; edgeView.output = from.portViews[connection.FromPortName]; edgeView.input = to.portViews[connection.ToPortName]; from.portViews[connection.FromPortName].Connect(edgeView); to.portViews[connection.ToPortName].Connect(edgeView); AddElement(edgeView); return(edgeView); }
public void RemoveNodeView(BaseNodeView nodeView) { RemoveElement(nodeView); NodeViews.Remove(nodeView.Model.GUID); }