public void PrintHelp(Main.Nodes.NodeTypesManager nodeTypes, EndPoint _remote) { Print("[HELP]", _remote); Print("+ create <type_name> -node_name", _remote); Print("<group_name> - group name which contains nodeType", _remote); Print("<type_name> - name of nodeType", _remote); Print("-node_name - name of node(optional)", _remote); Print("available node types:", _remote); foreach (Main.Nodes.NodeType t in nodeTypes.GetAll()) { Print(" " + t.FullName, _remote); } Print("+ print -node_name", _remote); Print("-node_name - name of node(optional)", _remote); Print("Print information about node", _remote); Print("+ connect <node1>.<port1> <node2>.<port2>", _remote); Print("<node1> - name of first node to connect", _remote); Print("<port1> - name of first port to connect", _remote); Print("<node2> - name of second node to connect", _remote); Print("<port2> - name of second port to connect", _remote); Print("+ set <node>.<port>", _remote); Print("Set constant to input port", _remote); Print("<node> - name of node to set constant", _remote); Print("<port> - name of Input port to set constant", _remote); Print("**************", _remote); }
public NodeTypesListViewModel(Main.Nodes.NodeTypesManager _types) { NodeTypes = _types; Elements = new ObservableCollection <IBundle>(); List <Main.Nodes.NodeType> types = _types.GetAll(); foreach (Main.Nodes.NodeType t in types) { // If nodeType is in root, lets just create it if (t.Bundles.Count == 0) { Elements.Add(new TypeViewModel(t.Name, t)); continue; } // Try find first group (if it isn't exists, create it) TypeGroupViewModel cur = Elements.FirstOrDefault(x => x.Name == t.Bundles[0]) as TypeGroupViewModel; if (cur == null) { cur = new TypeGroupViewModel(t.Bundles[0]); Elements.Add(cur); } // Lets add other bundles foreach (string bundle in t.Bundles.Skip(1)) { // Create new TypeGroup if it isn't exists var z = cur.Childs.FirstOrDefault(x => x.Name == bundle) as TypeGroupViewModel; if (z == null) { z = new TypeGroupViewModel(bundle); cur.Childs.Add(z); } cur = z; } // Lets add leaf(nodeType) cur.Childs.Add(new TypeViewModel(t.Name, t)); } }