Exemplo n.º 1
0
        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);
                }
            }
        }
Exemplo n.º 2
0
        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);
                }
            }
        }
Exemplo n.º 3
0
        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);
                }
        }
Exemplo n.º 4
0
        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;
        }