private void Application_Startup(object sender, StartupEventArgs e) { AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; Dispatcher.UnhandledException += Dispatcher_UnhandledException; TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException; SetIEFeature(IE_FEATURE_BROWSER_EMULATION, 0x2AF8); //CrystalPalette.Palette.AccentPressedColor = Colors.Bisque; //CrystalPalette.Palette.MouseOverHighColor = Colors.Bisque; //CrystalPalette.Palette.FontFamily = new FontFamily("Segoe UI"); //CrystalPalette.Palette.FontFamily = Application.Current.Resources["RobotoCondensed"] as FontFamily; //CrystalPalette.Palette.FontSize = 12; //CrystalPalette.Palette.CornerRadius = new CornerRadius(0); //FluentPalette.Palette.FontFamily = Application.Current.Resources["RobotoCondensed"] as FontFamily; //FluentPalette.Palette.FontSize = 13; //Office2013Palette.Palette.FontSizeL = 12; //Office2013Palette.Palette.FontSizeXL = 12; //Office2013Palette.Palette.FontFamily = new FontFamily("Roboto"); Locator.CurrentMutable.Register(() => new ExchangeView(), typeof(IViewFor <BinanceViewModel>)); Locator.CurrentMutable.Register(() => new ExchangeView(), typeof(IViewFor <DsxViewModel>)); Locator.CurrentMutable.Register(() => new ExchangeView(), typeof(IViewFor <BittrexViewModel>)); //Locator.CurrentMutable.Register(() => new ExchangeView(), typeof(IViewFor<HuobiViewModel>)); //Locator.CurrentMutable.Register(() => new ExchangeView(), typeof(IViewFor<CryptopiaViewModel>)); //Locator.CurrentMutable.Register(() => new ExchangeView(), typeof(IViewFor<HitBtcViewModel>)); //Locator.CurrentMutable.Register(() => new ExchangeView(), typeof(IViewFor<OKexViewModel>)); Locator.CurrentMutable.Register(() => new CreateTrade(), typeof(IViewFor <TradeTaskViewModel>)); Locator.CurrentMutable.Register(() => new CreateExchangeAccount(), typeof(IViewFor <CreateExchangeAccountViewModel>)); //orig:ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls | SecurityProtocolType.Ssl3; TelegramNotifier.Initialize(); }
private static void SendNotifications(AppSettings settings) { var carsWithoutNotification = _dbHelper.GetCarsWithoutNotification(); var urls = _dbHelper.GetUrls(carsWithoutNotification); var notifer = new TelegramNotifier(settings); notifer.SendNotificationsForCarsAsync(carsWithoutNotification, urls).Wait(); var logRecords = carsWithoutNotification.Select(c => new NotificationLog { CarId = c.Id, SentTimestamp = DateTime.UtcNow }).ToList(); _dbHelper.InsertNotificationsLog(logRecords); }
public BotTestClient(string chatId) { _chatId = chatId; var mailSenderMock = new Mock <IMailSender>(); _mailSender = mailSenderMock.Object; var serviceProvider = new ServiceCollection() .AddLogging(cfg => { cfg.AddConsole(); }) .Configure <LoggerFilterOptions>(cfg => cfg.MinLevel = LogLevel.Debug).BuildServiceProvider(); _logger = serviceProvider.GetService <ILogger <TelegramBotFunctionTests> >(); var testConfig = new Config { AzureDevOpsAccessToken = "", // todo: move to config AzureDevOpsAddress = "", // todo: move to config // todo: move to config CosmosDbConnectionString = "", EmailDomain = "@fake.fake", EMailPassword = "", FromEmailAddress = "*****@*****.**", Smtp = "smtp.local", TelegramBotKey = "fake_key" }; var optionsMock = new Mock <IOptions <Config> >(); optionsMock.Setup(i => i.Value).Returns(testConfig); var backlogAccessor = new BacklogAccessor(new QueryBuilder()); var botMock = new Mock <ITelegramBotClient>(); botMock.Setup(i => i.SendTextMessageAsync( It.IsAny <ChatId>(), It.IsAny <string>(), It.IsAny <ParseMode>(), It.IsAny <bool>(), It.IsAny <bool>(), It.IsAny <int>(), It.IsAny <IReplyMarkup>(), It.IsAny <CancellationToken>())) .Callback(new InvocationAction(action => _messages.Push((string)action.Arguments[1]))); var botProvider = new Mock <ITelegramBotProvider>(); botProvider.SetupGet(i => i.Client).Returns(botMock.Object); var notifier = new TelegramNotifier(optionsMock.Object, botProvider.Object, new MailSender(optionsMock.Object)); var reportingService = new ReportingService(notifier, backlogAccessor); throw new NotImplementedException(); //var dbAccessor = new DbAccessor(optionsMock.Object); //var commandProcessor = new CommandProcessor( // notifier, // reportingService, // dbAccessor, // _mailSender, // new FakePingGenerator(), // optionsMock.Object); //_target = new TelegramBotFunction(commandProcessor); }
/// <summary> /// /// </summary> public void SendTelegramWarning() { var telegramNotifier = new TelegramNotifier(); _notificationsService.SendWarning(telegramNotifier); }