예제 #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);
        }
예제 #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);
     }
 }
예제 #3
0
 private FileSystemNode Find(FileSystemNode arg, string otherPath)
 {
     foreach (FileSystemNode child in arg.Items)
     {
         if (child.Equals(otherPath))
         {
             return(child);
         }
     }
     return(null);
 }
예제 #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);
            }
        }
예제 #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);
                }
            }
        }