示例#1
0
        [UsedImplicitly]         // by ninject
        public GuiLoader(
            Loader loader,
            CardRepository repo,
            NewsService newsService,
            DownloaderSubsystem downloaderSubsystem,
            DeckListModel deckListModel,
            DeckSearcher deckSearcher,
            DeckIndexUpdateSubsystem deckIndexUpdateSubsystem)
        {
            _loader = loader;
            _repo   = repo;

            _loader.AddAction(newsService.FetchNews);
            _loader.AddAction(downloaderSubsystem.CalculateProgress);
            _loader.AddTask(async() =>
            {
                deckListModel.Load();

                if (deckSearcher.IsIndexSaved)
                {
                    deckSearcher.LoadIndexes();
                }
                else
                {
                    while (!_repo.IsPriceLoadingComplete)
                    {
                        await TaskEx.Delay(100);
                    }

                    deckSearcher.LoadIndexes();
                }
            });
        }
示例#2
0
        [UsedImplicitly]         // by ninject
        public GuiLoader(
            Loader loader,
            CardRepository repo,
            PriceRepository priceRepo,
            NewsService newsService,
            DownloaderSubsystem downloaderSubsystem,
            DeckListModel deckListModel,
            DeckSearcher deckSearcher,
            DeckIndexUpdateSubsystem deckIndexUpdateSubsystem)
        {
            _loader    = loader;
            _repo      = repo;
            _priceRepo = priceRepo;

            _loader.AddTask(newsService.FetchNews);
            _loader.AddTask(token => downloaderSubsystem.CalculateProgress());
            _loader.AddTask(async token =>
            {
                deckListModel.Load();
                if (deckSearcher.IsIndexSaved)
                {
                    deckSearcher.LoadIndexes();
                    await _priceRepo.IsLoadingPriceComplete.Wait(token);
                }
                else
                {
                    await _priceRepo.IsLoadingPriceComplete.Wait(token);
                    deckSearcher.LoadIndexes();
                }

                deckIndexUpdateSubsystem.SubscribeToEvents();
                deckListModel.FillCardNames();
                deckListModel.SubscribeToEvents();
            });
        }
示例#3
0
        [UsedImplicitly]         // by ninject
        public GuiLoader(
            Loader loader,
            CardRepository repo,
            CardRepository42 repo42,
            CardRepositoryLegacy repoLegacy,
            NewsService newsService,
            DownloaderSubsystem downloaderSubsystem,
            DeckListModel deckListModel,
            DeckListLegacyConverter deckListConverter,
            HistoryLegacyConverter historyConverter,
            DeckSearcher deckSearcher)
        {
            _loader            = loader;
            _repo              = repo;
            _repo42            = repo42;
            _repoLegacy        = repoLegacy;
            _deckListConverter = deckListConverter;
            _historyConverter  = historyConverter;

            _loader.AddAction(newsService.FetchNews);
            _loader.AddAction(downloaderSubsystem.CalculateProgress);
            _loader.AddTask(async() =>
            {
                if (deckListConverter.IsLegacyConversionRequired)
                {
                    while (!deckListConverter.IsConversionCompleted)
                    {
                        await TaskEx.Delay(100);
                    }
                }

                deckListModel.Load();

                if (deckSearcher.IsIndexSaved)
                {
                    deckSearcher.LoadIndexes();
                }
                else
                {
                    while (!_repo.IsPriceLoadingComplete)
                    {
                        await TaskEx.Delay(100);
                    }

                    deckSearcher.LoadIndexes();
                }
            });
        }