public void FillInToGraphControl(GraphControl gc) { gc.AddNodes(NodeIdentifierDict.Keys); foreach (NodeConnection NC in NodeConnections) { gc.Connect(NC.From.Item, NC.To.Item); } }
private void rebuildConnections(GraphControl graph, Dictionary <string, CConnectionFields> inputs, Dictionary <string, CConnectionFields> outputs) { foreach (String key in inputs.Keys) { CConnectionFields inputFields = inputs[key]; NodeConnection conn = new NodeConnection(); conn.Tag = TagFactory.GetTagObject(inputFields.Tag); conn.Name = inputFields.name; String[] fromNameParts = inputFields.From.Split(':'); String fromNodeName = fromNameParts[0]; String fromItemName = fromNameParts[1]; String[] toNameParts = inputFields.To.Split(':'); String toNodeName = toNameParts[0]; String toItemName = toNameParts[1]; Node fromNode = findNode(graph, fromNodeName); NodeItem fromItem = findItem(fromNode, fromItemName); Node toNode = findNode(graph, toNodeName); NodeItem toItem = findItem(toNode, toItemName); graph.Connect(fromItem.Output, toItem.Input); conn.FromItem = fromItemName; conn.ToItem = toItemName; } foreach (String key in outputs.Keys) { CConnectionFields outputFields = outputs[key]; NodeConnection conn = new NodeConnection(); conn.Tag = TagFactory.GetTagObject(outputFields.Tag); conn.Name = outputFields.name; String[] fromNameParts = outputFields.From.Split(':'); String fromNodeName = fromNameParts[0]; String fromItemName = fromNameParts[1]; String[] toNameParts = outputFields.To.Split(':'); String toNodeName = toNameParts[0]; String toItemName = toNameParts[1]; Node fromNode = findNode(graph, fromNodeName); NodeItem fromItem = findItem(fromNode, fromItemName); Node toNode = findNode(graph, toNodeName); NodeItem toItem = findItem(toNode, toItemName); graph.Connect(fromItem.Output, toItem.Input); conn.FromItem = fromItemName; conn.ToItem = toItemName; } graph.Refresh(); }