Exemple #1
0
        private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            string   _path = e.Node.Text;
            TreeNode temp  = e.Node.Parent;

            while (true)
            {
                if (temp != null)
                {
                    _path = temp.Text + "\\" + _path;
                    temp  = temp.Parent;
                }
                else
                {
                    break;
                }
            }
            path = SelectedDriver + _path + "\\";

            string AllDirs = hostInstance.GetDirs(path);

            if (!AllDirs.Equals("Thiết bị chưa sẵn sàng.\r\n"))
            {
                string[] dirs = AllDirs.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 && dir != Environment.NewLine)
                    {
                        e.Node.Nodes.Add(dir);
                    }
                }
                if (e.Node.Nodes.Count != 0)
                {
                    e.Node.Expand();
                }
            }
            else
            {
                MessageBox.Show("Thiết bị chưa sẵn sàng");
            }


            listView1.Items.Clear();
            HandleFiles(path);
        }