public ShopService( ITrackingRepository trackingRepository, IPullAndBearClient pullAndBearClient, IBershkaClient bershkaClient, IMapper mapper, IShopDefiner shopDefiner, ITimerService timerService) { _trackingRepository = trackingRepository ?? throw new ArgumentNullException(nameof(trackingRepository)); _pullAndBearClient = pullAndBearClient ?? throw new ArgumentNullException(nameof(pullAndBearClient)); _bershkaClient = bershkaClient ?? throw new ArgumentNullException(nameof(bershkaClient)); _mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); _shopDefiner = shopDefiner ?? throw new ArgumentNullException(nameof(shopDefiner)); _timerService = timerService ?? throw new ArgumentNullException(nameof(timerService)); }
public TimerService( ITrackingRepository trackingRepository, IPullAndBearClient pullAndBearClient, IBershkaClient bershkaClient, IBotService botService, ITextConverter textConverter, IUpdateInfoHelper updateInfoHelper) { _trackingRepository = trackingRepository ?? throw new ArgumentNullException(nameof(trackingRepository)); _pullAndBearClient = pullAndBearClient ?? throw new ArgumentNullException(nameof(pullAndBearClient)); _bershkaClient = bershkaClient ?? throw new ArgumentNullException(nameof(bershkaClient)); _botService = botService ?? throw new ArgumentNullException(nameof(botService)); _textConverter = textConverter ?? throw new ArgumentNullException(nameof(textConverter)); _updateInfoHelper = updateInfoHelper ?? throw new ArgumentNullException(nameof(updateInfoHelper)); var existedItems = _trackingRepository.GetItemsAsync().Result; itemsQueue = existedItems.Any() ? new Queue <Item>(existedItems) : new Queue <Item>(); timer = new Timer(10000); // 10 sec timer.Elapsed += OnTimedEvent; timer.AutoReset = true; timer.Enabled = true; }