Exemple #1
0
        public MonitoringService(
            SettingsProvider settingsProvider,
            MessageAdapter messageAdapter,
            InstagramExplorer instagramExplorer,
            ImageUtils imageUtils,
            IImageRepository imageRep)
        {
            _messageAdapter    = messageAdapter;
            _instagramExplorer = instagramExplorer;
            _imageUtils        = imageUtils;
            _imageRep          = imageRep;
            AppSettingsDto settings = settingsProvider.GetAppSettings();

            if (settings == null)
            {
                throw new InvalidOperationException();
            }

            _hashTag = settings.HashTag;
            var startSessionTime = imageRep.GetActiveSession(includeImages: false);

            if (startSessionTime == null)
            {
                imageRep.StartSession();
            }
            _startTime   = startSessionTime?.StartTime ?? DateTime.Now;
            _endTime     = settings.DateEnd;
            _printerName = settings.PrinterName;
        }
        public MonitoringService(
            SettingsProvider settingsProvider,
            MessageAdapter messageAdapter,
            InstagramExplorer instagramExplorer,
            ImageUtils imageUtils,
            IImageRepository imageRep)
        {
            _messageAdapter = messageAdapter;
            _instagramExplorer = instagramExplorer;
            _imageUtils = imageUtils;
            _imageRep = imageRep;
            AppSettingsDto settings = settingsProvider.GetAppSettings();
            if (settings == null)
                throw new InvalidOperationException();

            _hashTag = settings.HashTag;
            var startSessionTime = imageRep.GetActiveSession(includeImages: false);
            if (startSessionTime == null)
                imageRep.StartSession();
            _startTime = startSessionTime?.StartTime ?? DateTime.Now;
            _endTime = settings.DateEnd;
            _printerName = settings.PrinterName;
        }