Exemplo n.º 1
0
        public void AddChild(string newName, string newPath)
        {
            FileSystemNode add = new FileSystemNode();

            add.SetName(newName);
            add.SetPath(newPath);
            add.Expanded += OnExpand;
            Items.Add(add);
        }
Exemplo n.º 2
0
 private void OnExpand(object sender, RoutedEventArgs e)
 {
     try {
         FileSystemNode senderObj = sender as FileSystemNode;
         AppendTree(senderObj);
     }
     catch (Exception ex) {
         Console.WriteLine(ex.Message + "\r\n" + ex.StackTrace);
     }
 }
Exemplo n.º 3
0
 private FileSystemNode Find(FileSystemNode arg, string otherPath)
 {
     foreach (FileSystemNode child in arg.Items)
     {
         if (child.Equals(otherPath))
         {
             return(child);
         }
     }
     return(null);
 }
Exemplo n.º 4
0
        private void Tree(FileSystemNode arg, string path)
        {
            IEnumerable <string> subDir = TryGetDirectories(path);

            if (subDir == null)
            {
                return;
            }
            foreach (string d in subDir)
            {
                arg.AddChild(System.IO.Path.GetFileName(d), d);
            }
        }
Exemplo n.º 5
0
        public void AppendTree(FileSystemNode arg)
        {
            IEnumerable <string> subDir = TryGetDirectories(arg.GetPath());

            if (subDir == null)
            {
                return;
            }
            foreach (string d in subDir)
            {
                FileSystemNode child = Find(arg, d);
                if (child != null)
                {
                    AppendTree(child, d);
                }
            }
        }