public DownloadManager(PixivSetting setting, DownloaderService downloader, ICustomResolver <PixivClient> clientResolver) { _setting = setting; Downloader = downloader; _settingSubscriber = _setting.MaxDownloadsInParallel.Subscribe( _ => CheckStartNew()); ResumeDownloads(); async void ResumeDownloads() { var client = clientResolver.Resolve(); try { await foreach (int id in downloader.GetResumableDownloads().ConfigureAwait(true)) { var illust = await client.GetIllustDetailAsync(id).ConfigureAwait(true); var vm = GetOrAddDownloadable(illust); vm.SetWaiting(); QueueOne(vm); } } catch { return; } } }