private TreeNode buildTree(ScenegraphNode node, Separator initiallySelectedNodeToFind) { TreeNode tNode = new TreeNode(); tNode.Tag = node; //check for this being the currently selected node... if (node.isEqualSeparator(initiallySelectedNodeToFind)) { _initiallySelected = tNode; } string formatedName = node.Name.Length == 0 ? node.TypeName : String.Format("{0} ({1})", node.TypeName, node.Name); tNode.Text = formatedName; ScenegraphNode[] children = node.getChildren(); foreach (ScenegraphNode child in children) { tNode.Nodes.Add(buildTree(child, initiallySelectedNodeToFind)); } return(tNode); }
private TreeNode findTreeNodeContainingCoinNodeHelper(Separator nodeToSearchFor, TreeNode searchBase) { ScenegraphNode baseNode = (ScenegraphNode)searchBase.Tag; if (baseNode.isEqualSeparator(nodeToSearchFor)) { return(searchBase); } foreach (TreeNode child in searchBase.Nodes) { TreeNode subSearchResult = findTreeNodeContainingCoinNodeHelper(nodeToSearchFor, child); if (subSearchResult != null) { return(subSearchResult); } } //no luck return(null); }