Example #1
0
 public ItemManager(
     ItemRepository repository,
     ITradingPostApiWrapper apiWrapper)
 {
     _repository = repository;
     _apiWrapper = apiWrapper;
 }
Example #2
0
        private void Init()
        {
            // prevent design time error in xaml designer
            if (System.ComponentModel.DesignerProperties.GetIsInDesignMode(new DependencyObject()))
            {
                _contextProvider = new FakeDataContextProvider();
            }
            else
            {
                _contextProvider = new GameDataContextProvider();
            }

            _tpApiWrapper = new TradingPostApiWrapper(new ApiAccessor(new WebClientProvider()));
            _dataUpdater = new ApiDataUpdater(_tpApiWrapper);

            _dbBuilder = new DbBuilder(_tpApiWrapper, _contextProvider);
            _dbBuilder.BuildDatabase();

            using (var context = _contextProvider.GetContext())
            {
                _sharedItems = context.GameItems.ToList();
            }
            _sharedItemDictionary = _sharedItems.ToDictionary(item => item.ItemId, item => item);
            Task.Run(() => _dataUpdater.UpdatePricesParallel(_sharedItems));
        }
Example #3
0
 public DbBuilder(ITradingPostApiWrapper wrapper, IGameDataContextProvider contextProvider)
 {
     _wrapper = wrapper;
     _contextProvider = contextProvider;
 }
Example #4
0
 public ApiDataUpdater(ITradingPostApiWrapper wrapper)
 {
     _tpApiWrapper = wrapper;
 }
Example #5
0
 public CommerceService(ITradingPostApiWrapper tpWrapper, INotifyService notifyService)
 {
     _tpWrapper = tpWrapper;
     _notifyService = notifyService;
 }