Exemplo n.º 1
0
        public void FinishCollectionLoadProcess(ObservableCollection <VideoFolder> itemsSource, bool IsMovieFolder)
        {
            dispatcherService.InvokeDispatchAction(new Action(delegate
            {
                for (int i = 0; i < itemsSource.Count(); i++)
                {
                    VideoFolder VideoFolder = itemsSource[i];
                    if (VideoFolder.HasCompleteLoad)
                    {
                        continue;
                    }

                    if (!VideoFolder.HasCompleteLoad && fileloader.HasDataSource)
                    {
                        var videofolder = fileloader.GetExistingVideoFolderIfAny(VideoFolder);
                        if (videofolder != null)
                        {
                            itemsSource[i].SetParentDirectory(videofolder.ParentDirectory);
                            itemsSource.Remove(VideoFolder);
                            itemsSource.Insert(i, videofolder);
                            continue;
                        }
                    }

                    if (VideoFolder.ParentDirectory != null)
                    {
                        VideoFolder videoFoldercopy = null;
                        VideoFolder ExistingParent  =
                            MovieDataSource.GetExistingCopy((VideoFolder)VideoFolder.ParentDirectory);
                        if (ExistingParent != null && ExistingParent.OtherFiles != null)
                        {
                            videoFoldercopy =
                                ExistingParent.OtherFiles.Where(j => j.Equals(VideoFolder)).FirstOrDefault();
                        }

                        if (videoFoldercopy == null)
                        {
                            VideoFolder.IsLoading = true;
                        }
                        else
                        {
                            itemsSource.Remove(VideoFolder);
                            itemsSource.Insert(i, videoFoldercopy);
                            //MergeSameVideoData(ref videoFolder, videoFoldercopy);
                        }
                    }
                    //SearchSubtitleFile(list[i]);
                }
            }));
        }