public static void UpdateDirectory(FileSystemObjectInfo root, string path) { if (root.Children == null) { return; } var copyChildren = new List <FileSystemObjectInfo>(root.Children); root.Explore(); foreach (var child in copyChildren) { if (child.FileSystemInfo == null) { continue; } if (child.FileSystemInfo.FullName == path.Trim()) { child.Parent.Explore(); child.Explore(); } //Task.Factory.StartNew(()=>UpdateDirectory(child, path)); Application.Current.Dispatcher.Invoke(() => UpdateDirectory(child, path)); } }
public static FileSystemObjectInfo UpdateSpying(FileSystemObjectInfo root, string path) { if (root.Children == null) { return(null); } root.Explore(); foreach (var child in root.Children) { if (child.FileSystemInfo == null) { continue; } if (child.FileSystemInfo.FullName == path.Trim()) { child.IsSpyOn = true; return(child); } //Task.Factory.StartNew(() => UpdateSpying(child, path)); Application.Current.Dispatcher.Invoke(() => UpdateDirectory(child, path)); } return(null); }