Пример #1
0
        public TreeNode EnumerateDirectory(TreeNode parentNode)
        {
            try
            {
                parentNode.Nodes[0].Remove();
                foreach (var dir in _filesystem.GetDirectories(parentNode.FullPath))
                {
                    var node = new TreeNode {
                        Text = dir.Value, Tag = dir.Key
                    };
                    node.Nodes.Add("");
                    parentNode.Nodes.Add(node);
                }

                if (ShowFiles)
                {
                    foreach (var file in _filesystem.GetFiles(parentNode.FullPath, String.Empty))
                    {
                        var node = new TreeNode {
                            Text = file.Value, Tag = file.Key, ImageIndex = 2, SelectedImageIndex = 2
                        };
                        parentNode.Nodes.Add(node);
                    }
                }
            }

            catch (Exception e)
            {
            }

            return(parentNode);
        }