public void AddChild(string newName, string newPath) { FileSystemNode add = new FileSystemNode(); add.SetName(newName); add.SetPath(newPath); add.Expanded += OnExpand; Items.Add(add); }
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); } }
private FileSystemNode Find(FileSystemNode arg, string otherPath) { foreach (FileSystemNode child in arg.Items) { if (child.Equals(otherPath)) { return(child); } } return(null); }
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); } }
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); } } }