예제 #1
0
        private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            string _path = string.Empty;

            if (e.Node.Level == 0)
            {
                registry = e.Node.Text;
            }
            else
            {
                _path = e.Node.Text;
                TreeNode temp = e.Node.Parent;
                while (true)
                {
                    if (temp.Level != 0)
                    {
                        _path = temp.Text + "\\" + _path;
                        temp  = temp.Parent;
                    }
                    else
                    {
                        break;
                    }
                }
            }
            path = _path;
            string subKeys = hostInstance.GetSubKeys(_path, registry);

            string[] dirs = subKeys.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);

            if (e.Node.Nodes.Count != 0)
            {
                e.Node.Nodes.Clear();
            }

            foreach (string dir in dirs)
            {
                if (dir != string.Empty)
                {
                    e.Node.Nodes.Add(dir);
                }
            }
            if (e.Node.Nodes.Count != 0)
            {
                e.Node.Expand();
            }
            listView1.Items.Clear();
            GetValues(_path);
        }