public void BuildTree() { treeCtrl.Items.Clear(); string caption = m_rootNode.GetROMObjectID(); TreeViewItem current = new TreeViewItem(); current.Header = caption; current.Tag = m_rootNode; current.Name = "_" + m_rootNode.GetROMGUID().Replace('-', '_'); try { treeCtrl.UnregisterName(current.Name); } catch { } treeCtrl.RegisterName(current.Name, current); current.IsSelected = true; treeCtrl.Items.Add(current); ROMNode[] children = m_rootNode.GetAllChildren(false); if (children != null) { foreach (ROMNode child in children) { AddBranchAndChildren(current, child); } } }
public void AddBranchAndChildren(TreeViewItem parent, ROMNode node) { string caption = node.GetROMObjectID(); TreeViewItem current = null; if (parent != null) { current = new TreeViewItem(); current.Header = caption; current.Tag = node; current.Name = "_" + node.GetROMGUID().Replace('-', '_'); try { treeCtrl.UnregisterName(current.Name); } catch { } treeCtrl.RegisterName(current.Name, current); parent.Items.Add(current); } ROMNode[] children = node.GetAllChildren(false); if (children != null) { foreach (ROMNode child in children) { AddBranchAndChildren(current, child); } } }
public void AddBranchAndChildren(TreeViewItem parent, ROMNode node) { string caption = node.GetROMObjectID(); TreeViewItem current = null; if (parent != null) { current = new TreeViewItem(); current.Header = caption; current.Tag = node; current.Name = "_" + node.GetROMGUID().Replace('-', '_'); try { treeCtrl.UnregisterName(current.Name); } catch { } treeCtrl.RegisterName(current.Name, current); parent.Items.Add(current); } ROMNode[] children = node.GetAllChildren(false); if (children != null) foreach (ROMNode child in children) { AddBranchAndChildren(current, child); } }
public void Update() { if (m_rootNode == null) { return; } m_bLoading = true; ROMNode node = null; TreeViewItem item = (TreeViewItem)treeCtrl.SelectedItem; if (item != null) { node = (ROMNode)item.Tag; } BuildTree(); item = null; if (node != null) { item = (TreeViewItem)treeCtrl.FindName("_" + node.GetROMGUID().Replace('-', '_')); } if (item != null) { item.IsSelected = true; DisplayAttributeGrid(item); } else { if (treeCtrl.Items.Count > 0) { ((TreeViewItem)treeCtrl.Items[0]).IsSelected = true; DisplayAttributeGrid((TreeViewItem)treeCtrl.Items[0]); } } m_bLoading = false; }