private async void ReadHTML_Click(object sender, RoutedEventArgs e) { HtmlTextBox.Text = await Task.Run(() => _scrapper.ReadHtml(_htmlLocalization)); await Task.Delay(100); ConvertButton.IsEnabled = true; StatusTextBox.Text += $"{DateTime.Now:T} Html file read\n"; StatusTextBox.ScrollToEnd(); }
private void SetStatus(string Message) { //Check for cross threading if (StatusTextBox.Dispatcher.CheckAccess() == false) { Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action <string>)SetStatus, Message); return; } StatusTextBox.AppendText(Environment.NewLine + Message); StatusTextBox.ScrollToEnd(); }
/// <summary> /// Displays a work progress message in the status textbox. /// Right now this only displays items that have failed validation. Mostly /// this is there to show that the application is working and isn't stalled out. /// </summary> /// <param name="message"></param> void AppendStatusMessage(string message) { if (message == null || message == "") { return; } // Add results to the data grid as soon as they are available StatusTextBox.Text += Environment.NewLine + Environment.NewLine; StatusTextBox.Text += message; StatusTextBox.Focus(); StatusTextBox.CaretIndex = StatusTextBox.Text.Length; StatusTextBox.ScrollToEnd(); }
private async void GoogleServices_Click(object sender, RoutedEventArgs e) { _googleApi.CreateGoogleToken(_credentialsLocalization); await Task.Delay(200); StatusTextBox.Text += $"{DateTime.Now:T} Generated Google token\n"; StatusTextBox.ScrollToEnd(); _googleApi.CreateGoogleCalendarService(); await Task.Delay(200); AddEventsButton.IsEnabled = true; StatusTextBox.Text += $"{DateTime.Now:T} Created Google calendar service\n"; StatusTextBox.ScrollToEnd(); }
private async void Convert_Click(object sender, RoutedEventArgs e) { HtmlTextBox.Text = await Task.Run(() => _scrapper.ConvertHtmlToClass(_scrapper.TableElements)); await Task.Delay(200); if (_credentialsLocalization == null) { ErrorLabel.Content = "Please add credentials.json and press Convert again"; } else { ErrorLabel.Content = ""; GoogleServicesButton.IsEnabled = true; StatusTextBox.Text += $"{DateTime.Now:T} Html file converted\n"; StatusTextBox.ScrollToEnd(); } }
private void ShowStatus(string str, bool newline = true) { if (App.Current != null) { if (newline) { App.Current.Dispatcher.Invoke((Action) delegate { StatusTextBox.AppendText(str + '\n'); StatusTextBox.ScrollToEnd(); }); } else { App.Current.Dispatcher.Invoke((Action) delegate { StatusTextBox.AppendText(str); }); } } }
private async void LoadCredentials_Click(object sender, RoutedEventArgs e) { try { OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "JSON (*.json)|*.json"; if (ofd.ShowDialog() == true) { _credentialsLocalization = ofd.FileName; CredentialsLocalizationTextBox.Text = ofd.FileName; await Task.Delay(200); StatusTextBox.Text += $"{DateTime.Now:T} Credentials file loaded\n"; StatusTextBox.ScrollToEnd(); } } catch (Exception exception) { MessageBox.Show(exception.Message); throw; } }
private async void LoadHtml_Click(object sender, RoutedEventArgs e) { try { OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "Html (*.html)|*.html"; if (ofd.ShowDialog() == true) { _htmlLocalization = ofd.FileName; HtmlLocalizationTextBox.Text = ofd.FileName; await Task.Delay(200); ReadHtmlButton.IsEnabled = true; StatusTextBox.Text += $"{DateTime.Now:T} Html file loaded\n"; StatusTextBox.ScrollToEnd(); } } catch (Exception exception) { MessageBox.Show(exception.Message); throw; } }
private void OnDialerStateChanged(DialerStateChangedMessage message) { StatusTextBox.AppendText(message.Message + Environment.NewLine); StatusTextBox.ScrollToEnd(); }
/// <summary> /// Событие по изминению текста, перемещает скрол в конец текстбокса. /// </summary> private void StatusTextBox_TextChanged(object sender, TextChangedEventArgs e) { StatusTextBox.ScrollToEnd(); }
private void SafeUpdateStatus(string statusText) { StatusTextBox.AppendText(statusText); StatusTextBox.ScrollToEnd(); }
public void ScrollToEnd() { StatusTextBox.ScrollToEnd(); }
private void AddEvent_Click(object sender, RoutedEventArgs e) { _googleApi.AddEventToCalendar(_scrapper.Lessons, int.Parse(ReminderTextBox.Text)); StatusTextBox.Text += $"{DateTime.Now:T} Added {_scrapper.Lessons.Count} lessons to your schedule. Enjoy\n"; StatusTextBox.ScrollToEnd(); }