示例#1
0
        public LoginPageVM(
            IPixivSettingStore settingStore,
            PixivSetting setting,
            PixivClientService clientService,
            EHunterDbContextResolver <EHunterDbContext> eHunterContextResolver,
            EHunterDbContextResolver <PixivDbContext> pixivContextResolver)
        {
            _settingStore  = settingStore;
            _setting       = setting;
            _clientService = clientService;

            _connectionMode = _setting.ConnectionMode.Value;

            string?savedToken = settingStore.RefreshToken;

            if (!string.IsNullOrEmpty(savedToken))
            {
                RefreshToken = savedToken;
                LoginWithToken();
            }

            InitDatabase();
            async void InitDatabase()
            {
                await Task.WhenAll(eHunterContextResolver.InitializeTask, pixivContextResolver.InitializeTask).ConfigureAwait(true);

                DatabaseInitState = eHunterContextResolver.Resolve() is not null && pixivContextResolver.Resolve() is not null;
                CheckInitialize();
            }
        }
示例#2
0
 public PixivSetting(IPixivSettingStore settingStore)
 {
     _settingStore          = settingStore;
     MaxDownloadsInParallel = new(_settingStore.MaxDownloadsInParallel);
     ConnectionMode         = new(_settingStore.ConnectionMode);
 }