Esempio n. 1
0
        private void DirectoryExpanded(object sender, DirectoryExpandedEventArgs e)
        {
            var    dirs      = e.currentPath.Split("\\");
            string parentDir = null;

            if (dirs.Length > 2)
            {
                parentDir = dirs[dirs.Length - 3];
            }



            var tn = treeView1.Nodes;
            //var tn = treenodes;
            string show = "";

            show += "Parent node if: " + parentDir + "\n";
            //show += "Selected: " + e.currentPath + "\n";
            //show += "Current name: " + e.currentName + "\n";
            TreeNode parentNode = null;

            foreach (TreeNode node in tn)
            {
                show += node.Text + " - a \n";
                if (e.parent == node.Text)
                {
                    show      += "found!!!! \n";
                    parentNode = node;
                    //break;
                }
            }


            show += parentNode?.Text + " - Parent node nodes: " + parentNode?.Nodes?.Count;



            MessageBox.Show(show);

            parentNode?.Nodes?.Add(e.currentName)?.Nodes.Add("_");

            /*
             * var tmp = model.data[e.currentName];
             * var dir = tmp.EnumerateDirectories();
             * if (dir.ToArray().Length == 0)
             * {
             *  parentNode?.Nodes.Add("_");
             * }
             * foreach (var item in dir)
             * {
             *  parentNode?.Nodes.Add(item.ToString());
             * }*/
        }
Esempio n. 2
0
        private void DirectoryExpanded(object sender, DirectoryExpandedEventArgs e)
        {
            TreeNode[] expandedNode = treeView.Nodes.Find(e.ExpandedDir, true);
            Debug.WriteLine(e.ExpandedDir + "  " + expandedNode.Length);
            //Mindig nullát ad vissza valamiért...

            if (expandedNode.Length == 0) // meghajtót adunk hozzá
            {
                // ...
                treeView.Nodes.Add(e.ExpandedDir).Nodes.Add("");
            }
            else // könyvtárat adunk hozzá
            {
                // ...
                Debug.WriteLine("több van");
                //treeView.SelectedNode.Nodes.Add(e.ExpandedDir);
            }
        }
Esempio n. 3
0
        private void DirectoryExpanded(object sender, DirectoryExpandedEventArgs e)
        {
            /*
             * NOT WORKING !!!!!
             *
             * var tn = treeView1.Nodes;
             * //var tn = treenodes;
             * string show = "";
             * TreeNode parentNode = null;
             *
             * foreach (TreeNode node in tn)
             * {
             *   show += node.Text + " - a \n";
             *   if (e.parent == node.Text)
             *   {
             *       show += "found!!!! \n";
             *       parentNode = node;
             *       //break;
             *   }
             * }
             *
             *
             * show += parentNode?.Text + " - Parent node nodes: " + parentNode?.Nodes?.Count;
             *
             * parentNode?.Nodes?.Add(e.currentName)?.Nodes.Add("_");
             *
             *
             * var tmp = model.data[e.currentName];
             * var dir = tmp.EnumerateDirectories();
             * if (dir.ToArray().Length == 0)
             * {
             *   parentNode?.Nodes.Add("_");
             * }
             * foreach (var item in dir)
             * {
             *   parentNode?.Nodes.Add(item.ToString());
             * }*/

            model.clicked.Nodes.Add(e.currentName).Nodes.Add("_");
        }