private void BuildTreeNode(Simulatable item, TreeNode parentNode) { TreeNode node = new TreeNode(item.NameOrDefault); node.Name = item.GetHashCode().ToString(); if (parentNode == null) treeView.Nodes.Add(node); else parentNode.Nodes.Add(node); foreach (Simulatable child in item.PersistentSimulatableChildren) BuildTreeNode(child, node); }
private TreeNode GetTreeNode(Simulatable item) { if (item == null) return null; TreeNode[] nodes = treeView.Nodes.Find(item.GetHashCode().ToString(), true); return nodes.FirstOrDefault(); }