Blacker.MangaScraper.ViewModel.MainWindowViewModel.LoadChapters C# (CSharp) Метод

LoadChapters() приватный Метод

private LoadChapters ( IMangaRecord manga ) : void
manga IMangaRecord
Результат void
        private void LoadChapters(IMangaRecord manga)
        {
            if (manga == null)
                return;

            var scraper = CurrentScraper;

            OperationInProgress = true;
            CurrentActionText = "Loading chapters ...";

            _requestQueue.Add(
                () => scraper.GetAvailableChapters(manga),
                (r, e) =>
                {
                    var results = r as IEnumerable<IChapterRecord>;
                    if (e == null && results != null)
                    {
                        lock (_syncRoot)
                        {
                            // just replace collection -> this is easier than removing and then adding records
                            Chapters =
                                new AsyncObservableCollection<ChapterViewModel>(
                                    results.Select(ch => new ChapterViewModel(ch, ServiceLocator.Instance.GetService<Library.ILibraryManager>().GetDownloadInfo(ch, true))));
                            OnPropertyChanged(() => Chapters);
                        }
                    }
                }
            );
        }