Example #1
0
        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;
                }
            }
        }
Example #2
0
        public void Search()
        {
            var client = _clientResolver.Resolve();
            var users  = client.SearchUsersAsync(SearchWord);

            Users = _viewModelService.CreateAsyncCollection(users);
        }
Example #3
0
        public PixivSettingsVM(PixivSetting settings, ICustomResolver <PixivClient> clientResolver)
        {
            _settings = settings;

            _maxDownloadsInParallel = _settings.MaxDownloadsInParallel.Value;
            _connectionMode         = _settings.ConnectionMode.Value;
            Client = clientResolver.Resolve();
        }
Example #4
0
 public DownloaderService(
     ICustomResolver <PixivClient> pixivClientResolver,
     IDbContextFactoryResolver <EHunterDbContext> eHunterContextResolver,
     IDbContextFactoryResolver <PixivDbContext> pixivDbContextResolver,
     IStorageSetting storageSetting)
 {
     _client = pixivClientResolver.Resolve();
     _eHunterContextResolver = eHunterContextResolver;
     _pixivDbContextResolver = pixivDbContextResolver;
     _storageSetting         = storageSetting;
 }
Example #5
0
        public void Refresh()
        {
            var client = _clientResolver.Resolve();

            Users = _viewModelService.CreateAsyncCollection(client.GetMyFollowingUsersAsync());
        }
Example #6
0
 protected override IAsyncEnumerable <Illust>?LoadIllusts()
 => _clientResolver.Resolve().GetIllustRankingAsync(SelectedRankingMode, Date.Date);
Example #7
0
 protected override IAsyncEnumerable <Illust>?LoadIllusts()
 => _clientResolver.Resolve().GetMyBookmarksAsync(Visibility.Public);
Example #8
0
 protected override IAsyncEnumerable <Illust>?LoadIllusts()
 => _clientResolver.Resolve().GetMyFollowingIllustsAsync();