private void LoadInternet(object sender, RoutedEventArgs e) { if (isRunning || listCollection != null) { if (parser.IsActive) { parser.Abort(); } listAbiturient.ItemsSource = null; listCollection.Clear(); listab.Clear(); listTarget.Clear(); listSpecial.Clear(); } else { listCollection = new List <Abiturient>(); listab = new List <Abiturient>(); listTarget = new List <Abiturient>(); listSpecial = new List <Abiturient>(); } currentPage = 1; parser = new ParserWorker <string[]>(new VuzParser()); parser.OnNewData += Parser_OnNewData; parser.Settings = new VuzSettings(startPage, int.Parse(endPageTB.Text)); parser.Settings.BaseUrl = linkTB.Text; parser.Start(); isRunning = true; }
private void Parser_OnCompleted(object obj) { try { Logs.WriteLog("COMPLETED-Checking updates has been completed!"); Progress = 0; parser.Abort(); } catch (Exception ex) { ErrorWriter.WriteError(ex); } }
public override async Task Execute(Message message, TelegramBotClient botClient) { var chatId = message.Chat.Id; parser = new ParserWorker <Replacement[]>( new BcpepParser(), new BcpepSettings() ); parser.Start(); string group = (message.Text.Length > Name.Length + 1) ? message.Text.Substring(Name.Length + 1).Trim() : ""; string botMsg = "Error: Некоректні дані!"; //Replacement[] data = null; Replacement result = null; Replacement[] data = await parser.GetGroups(); if (group.Length < 10 && group.Length > 2) { if (data != null) { for (int i = 0; i < data.Length; i++) { if (data[i].Group.Contains(group)) { result = data[i]; break; } } if (result != null) { //await botClient.SendTextMessageAsync(chatId, result.ToString(), parseMode: Telegram.Bot.Types.Enums.ParseMode.Markdown); botMsg = result.ToString(); } else { //await botClient.SendTextMessageAsync(chatId, $"Error: Не вдалося знайти групу \"{group}\"", parseMode: Telegram.Bot.Types.Enums.ParseMode.Markdown); botMsg = $"Error: Не вдалося знайти групу \"{group}\"!"; } } else { //await botClient.SendTextMessageAsync(chatId, $"Error: Помилка підключення до bcpep.org.ua", parseMode: Telegram.Bot.Types.Enums.ParseMode.Markdown); botMsg = $"Error: Помилка підключення до bcpep.org.ua!"; } } await botClient.SendTextMessageAsync(chatId, botMsg, parseMode : Telegram.Bot.Types.Enums.ParseMode.Default); parser.Abort(); }
private void ButtonAbort_Click(object sender, EventArgs e) { parser.Abort(); ListTitles.Items.Clear(); }
private void btnAbort_Click(object sender, EventArgs e) { parser.Abort(); }
private void buttonAbort_Click(object sender, RoutedEventArgs e) { parser.Abort(); }
private void EndParse(object obj) { parser.Abort(); }
private void button1_Click_1(object sender, EventArgs e) { parser.Abort(); }
public void button2_Click() { parser.Abort(); }
private void Button_Click_1(object sender, RoutedEventArgs e) { parser.Abort(); start.IsEnabled = true; }
private void button2_Click(object sender, EventArgs e) { parser.Abort(); panelLeft.Height = button2.Height; panelLeft.Top = button2.Top; }
private void Stop_Click(object sender, RoutedEventArgs e) { parser.Abort(); }
private void ButtonAbort_Click(object sender, EventArgs e) { parser.Abort(); TimerUpdata.Enabled = false; }
public void ButtonSrop_Click(object sender, EventArgs e) { parser.Abort(); }
private void button2_Click(object sender, EventArgs e) { parserMP.Abort(); }
private void buttonStop_Click(object sender, EventArgs e) { parser.Abort(); }
private void ButtonAbort_Click(object sender, EventArgs e) { parser.Abort(); ListTitels.Items.Add("Parsing stopped."); }
private void AbortBtn_Click(object sender, EventArgs e) { parser.Abort(); }
private void abort_button_Click(object sender, EventArgs e) { parser.Abort(); }
private async void CheckReplacementUpdates(object state) { _logger.LogInformation("Timed Background Service is working."); parser.Start(); //DateTime from web, because time in PaaS and here is different //configurate Heroku to heroku config:add TZ="Europe/Kiev" DateTime dd = DateTime.Now; if (dd.Hour < 11 && currentReplacementDate == null) { currentReplacementDate = await parser.GetDate(); } //if (dd.Hour == 11 && dd.Minute == 0 && isSent == false) if (dd.Hour >= 11 && dd.Hour <= 16 && isSent == false) { newReplacementDate = await parser.GetDate(); //DEBUG: _logger.LogInformation($"Current: {currentReplacementDate}; New: {newReplacementDate}"); if (currentReplacementDate != null && currentReplacementDate != newReplacementDate) { using (var connection = new NpgsqlConnection(AppSettings.ConnString)) { connection.Open(); string group = ""; Replacement result = null; Replacement[] data = null; ChatId chatId = null; using (var cmd = new NpgsqlCommand()) { cmd.Connection = connection; cmd.CommandText = @"SELECT * FROM users"; using (var reader = await cmd.ExecuteReaderAsync()) { while (await reader.ReadAsync()) { group = reader["groupname"].ToString(); chatId = new ChatId(int.Parse(reader["chatid"].ToString())); result = null; data = await parser.GetGroups(); if (data != null) { for (int i = 0; i < data.Length; i++) { if (data[i].Group.Contains(group)) { result = data[i]; break; } } if (result != null) { Bot.SendMessageAsync(chatId, result.ToString()); //_logger.LogInformation($"Sended to {int.Parse(reader["chatid"].ToString())}"); } else { Bot.SendMessageAsync(chatId, $"На {newReplacementDate} замін немає."); } isSent = true; } } } } } currentReplacementDate = null; } //else //_logger.LogInformation("There nothing to send! On the site non actual data"); //Thread.Sleep(TimeSpan.FromMinutes(1)); } else if (dd.Hour < 11 && dd.Hour > 16) { isSent = false; } parser.Abort(); }