Example #1
0
 public CustomItemProvider(CollectionViewModel cvm)
     : this(cvm.VideoDataAccess.ChildrenSize, 1000)
 {
     CVM = cvm;
     CollectionVM.ViewChanged += ViewChangeExecuted;
     BGW                            = new BackgroundWorker();
     BGW.DoWork                    += BGW_DoWork;
     BGW.ProgressChanged           += BGW_ProgressChanged;
     BGW.RunWorkerCompleted        += BGW_RunWorkerCompleted;
     BGW.WorkerSupportsCancellation = true;
     BGW.WorkerReportsProgress      = true;
 }
 public LoadCollectionDataCommand(ILoadCollectionService <T> loadCollectionService, ICollectionViewModel <T> collectionViewModel)
 {
     _loadCollectionService = loadCollectionService;
     _collectionViewModel   = collectionViewModel;
 }
        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);
        }