コード例 #1
0
        private ConfigTreeNode getChildren(ConfigNode node, string searchWord = null)
        {
            //Check attributes
            bool           wordFound = false;
            ConfigTreeNode treeNode  = null;

            foreach (ConfigNode.Value value in node.values)
            {
                if (searchWord == null || CultureInfo.CurrentCulture.CompareInfo.IndexOf(value.value, searchWord, CompareOptions.IgnoreCase) >= 0)
                {
                    //match found
                    wordFound = true;
                    treeNode  = makeTreeNode(node);
                    break;
                }
            }

            if (node.CountNodes > 0)
            {
                foreach (ConfigNode childNode in node.nodes.GetNodes())
                {
                    ConfigTreeNode childTreeNode = getChildren(childNode, wordFound ? null : searchWord);
                    if (childTreeNode != null)
                    {
                        //Child contains searchWord
                        if (treeNode == null)
                        {
                            treeNode = makeTreeNode(node);
                        }
                        treeNode.Nodes.Add(childTreeNode);
                    }
                }
            }
            return(treeNode);
        }
コード例 #2
0
        private void populateConfigTree(ConfigTreeNode topTreeNode, string searchWord = null)
        {
            //TODO root has attributes
            configTree.BeginUpdate();
            configTree.Nodes.Clear();

            ConfigTreeNode root        = new ConfigTreeNode(topTreeNode.Data);
            bool           searchFound = false;

            foreach (ConfigTreeNode node in topTreeNode.Nodes)
            {
                ConfigTreeNode treeNode = getChildren(node, searchWord);
                if (treeNode != null)
                {
                    searchFound = true;
                    root.Nodes.Add(treeNode);
                    //configTree.Nodes.Add(treeNode);
                }
            }
            if (searchFound)
            {
                configTree.Nodes.Add(root);
                root.Expand();
            }
            configTree.EndUpdate();
        }
コード例 #3
0
 private ConfigTreeNode getUrlConfigTreeNode(ConfigTreeNode treeNode)
 {
     if (treeNode == null)
     {
         return(null);
     }
     if (treeNode.Data.name == URLCONFIG)
     {
         return(treeNode);
     }
     else
     {
         return(getUrlConfigTreeNode((ConfigTreeNode)treeNode.Parent));
     }
 }
コード例 #4
0
 private void rebuildTypeFilteredConfigTree()
 {
     typeFilteredRoot = new ConfigTreeNode(topNode);
     foreach (ConfigNode node in topNode.nodes.GetNodes())
     {
         if (node.name.Equals(URLCONFIG, StringComparison.InvariantCultureIgnoreCase) && node.HasValue("type") && filters.IsActive(node.GetValue("type")))
         {
             ConfigTreeNode treeNode = getChildren(node);
             if (treeNode != null)
             {
                 typeFilteredRoot.Nodes.Add(treeNode);
                 //configTree.Nodes.Add(treeNode);
             }
         }
     }
     rebuildConfigTree();
 }
コード例 #5
0
 private void configTree_AfterSelect(object sender, TreeViewEventArgs e)
 {
     if (e.Action == TreeViewAction.ByMouse || e.Action == TreeViewAction.ByKeyboard)
     {
         ConfigTreeNode selected   = (ConfigTreeNode)e.Node;
         ConfigNode     configNode = selected.Data;
         if (configNode.name == URLCONFIG)
         {
             configView.SetData(configNode);
         }
         else
         {
             ConfigTreeNode urlConfigTreeNode = getUrlConfigTreeNode(selected);
             if (urlConfigTreeNode != null)
             {
                 configView.SetData(urlConfigTreeNode.Data, configNode);
             }
         }
     }
 }
コード例 #6
0
        private void populateConfigTree(ConfigNode topNode, string searchWord = null)
        {
            //TODO root has attributes

            configTree.BeginUpdate();
            configTree.Nodes.Clear();
            ConfigTreeNode root = new ConfigTreeNode(topNode);

            foreach (ConfigNode node in topNode.nodes.GetNodes())
            {
                ConfigTreeNode treeNode = getChildren(node, searchWord);
                if (treeNode != null)
                {
                    root.Nodes.Add(treeNode);
                    //configTree.Nodes.Add(treeNode);
                }
            }
            configTree.Nodes.Add(root);
            root.Expand();
            configTree.EndUpdate();
        }