Beispiel #1
0
 private void _vm_LogAppended(object sender, System.EventArgs e)
 {
     if (TextBoxLog.IsFocused)
     {
         return;
     }
     TextBoxLog.ScrollToEnd();
 }
 public MainWindow()
 {
     InitializeComponent();
     DataContext = new ViewModel(msg =>
     {
         TextBoxLog.AppendText(msg + Environment.NewLine);
         TextBoxLog.ScrollToEnd();
     });
 }
 public void AppendLog(string s)
 {
     TextBoxLog.Text += s;
     if (s.Last() == '\n')
     {
         if (TextBoxLog.LineCount > 50)
         {
             var index = TextBoxLog.Text.IndexOf("\r\n");
             if (index >= 0)
             {
                 TextBoxLog.Text = TextBoxLog.Text.Substring(index + 2);
             }
         }
         TextBoxLog.ScrollToEnd();
     }
 }
Beispiel #4
0
 private async void CheckLoadLog_Checked(object sender, RoutedEventArgs e)
 {
     assistant.WriteLog("Log wird automatisch ausgelesen!");
     TextBoxLog.ScrollToEnd();
     while (CheckLoadLog.IsChecked == true)
     {
         if (File.Exists(assistant.GetLogPath()))
         {
             TextBoxLog.Text = File.ReadAllText(assistant.GetLogPath());
         }
         else
         {
             TextBoxLog.Text = "Keine Log-Datei gefunden...";
         }
         await Task.Delay(TimeSpan.FromMilliseconds(100));
     }
 }
Beispiel #5
0
 private void TextBoxLog_TextChanged(object sender, TextChangedEventArgs e)
 {
     TextBoxLog.ScrollToEnd();
 }