Exemplo n.º 1
0
        public BerApp(BerConfig berConfig)
        {
            Log.Logger = new LoggerConfiguration()
                         .WriteTo.Console()
                         .CreateLogger();

            Log.Information("Berlinator started!");

            if (berConfig == BerConfig.Empty)
            {
                Log.Warning("Configuration is empty.");
            }

            _berConfig = berConfig;
            _berAlarm  = new BerAlarm(berConfig);

            var service = ChromeDriverService.CreateDefaultService();

            service.SuppressInitialDiagnosticInformation = false;
            service.HideCommandPromptWindow = true;
            service.EnableVerboseLogging    = false;
            _driver = new ChromeDriver(service);

            _berMonitor = new BerMonitor(_driver, _berAlarm);

            _berMonitor.TerminsFoundEventHandler += BerMonitorOnTerminsFoundEventHandler;
            _berMonitor.TerminCalendarPageCorruptedEventHandler += BerMonitorOnTerminCalendarPageCorruptedEventHandler;
        }
Exemplo n.º 2
0
        public BerAlarm(BerConfig berConfig)
        {
            _berConfig = berConfig;

            if (!string.IsNullOrWhiteSpace(berConfig.TelegramToken))
            {
                try
                {
                    _botClient    = new TelegramBotClient(berConfig.TelegramToken);
                    _isBotEnabled = true;
                }
                catch
                {
                    _isBotEnabled = false;
                }
            }
        }