public static VideoFolder LoadParent2(DirectoryInfo DirectoryPosition, SortType sorttype) { VideoFolder ParentDir = null; List <VideoFolder> children = new List <VideoFolder>(); List <DirectoryInfo> ParentSubDir = FileExplorerCommonHelper.GetParentSubDirectory(DirectoryPosition, FileLoader.formats); // Dispatcher.Invoke(new Action(delegate //{ ParentDir = new VideoFolder(DirectoryPosition.FullName); foreach (var item in ParentSubDir) { VideoFolder child = LoadParent2(item, sorttype); children.Add(child); } GetRootDetails(sorttype, ParentDir); // })); return(ParentDir); }
public static VideoFolder LoadParentFiles(VideoFolder ParentDir, SortType sorttype, ICollectionViewModel collectionVM) { // Dispatcher.Invoke(new Action(delegate { ObservableCollection <VideoFolder> children; List <DirectoryInfo> ParentSubDir = FileExplorerCommonHelper.GetParentSubDirectory(ParentDir.Directory, formats); if (ParentSubDir == null) { collectionVM.IsLoading = false; return(new VideoFolder(ParentDir, ParentDir.Directory.Extension)); } children = new ObservableCollection <VideoFolder>(); collectionVM.IsLoading = true; children = LoadChildrenFiles(ParentDir); for (int i = 0; i < ParentSubDir.Count; i++) { if (ParentSubDir[i].Name == ".movies") { ParentSubDir.Remove(ParentSubDir[i]); i -= 1; continue; } VideoFolder child = LoadDirInfo(ParentDir, ParentSubDir[i]); children.Add(child); } if (ParentDir.OtherFiles == null || children.Count > ParentDir.OtherFiles.Count) { ParentDir.OtherFiles = new ObservableCollection <VideoFolder>(); ParentDir.OtherFiles.AddRange(children); GetRootDetails(sorttype, ParentDir); } // })); collectionVM.IsLoading = false; return(ParentDir); }