Example #1
0
        public GameSourceService(ISettingsService settings, IEventAggregator eventAggregator)
        {
            var key = settings.Get().GiantBombApiKey;

            if (!String.IsNullOrWhiteSpace(key))
            {
                _client = new GiantBombRestClient(key);
                eventAggregator.GetEvent <SearchReadinessUpdated> ().Publish(IsReady);
            }

            eventAggregator.GetEvent <SettingsUpdated> ().Subscribe(s => {
                _client = null;

                if (!String.IsNullOrWhiteSpace(s.GiantBombApiKey))
                {
                    _client = new GiantBombRestClient(s.GiantBombApiKey);
                }

                eventAggregator.GetEvent <SearchReadinessUpdated> ().Publish(IsReady);
            }, true);
        }
Example #2
0
 public GameRepository(IGiantBombRestClientWrapper giantBombRestClient, ICacheDbRepository cacheDbRepository)
 {
     this._giantBombRestClient = giantBombRestClient?.GetClient() ?? throw new ArgumentNullException(nameof(giantBombRestClient));
     this._cacheDbRepository   = cacheDbRepository ?? throw new ArgumentNullException(nameof(cacheDbRepository));
 }