Exemplo n.º 1
0
 private void ISLogger_MessageOut(object sender, string text)
 {
     if (ConsoleTextBox.InvokeRequired)
     {
         ConsoleTextBox.Invoke(new Action(() => ISLogger_MessageOut(null, text)));
     }
     else
     {
         ConsoleTextBox.AppendText(text);
     }
 }
Exemplo n.º 2
0
 public void WriteLine(string text)
 {
     if (ConsoleTextBox.InvokeRequired)
     {
         var del = new SafeCallTextDelegate(WriteLine);
         ConsoleTextBox.Invoke(del, text);
     }
     else
     {
         this.ConsoleTextBox.AppendText("[" + GetTimestamp() + "] " + text + Environment.NewLine);
         Console.WriteLine(text);
     }
 }
Exemplo n.º 3
0
 private void AppendToLog(string text)
 {
     try
     {
         var textToAppend = DateTime.Now + " | " + text + "\n";
         try
         {
             ConsoleTextBox.AppendText(textToAppend);
         }
         catch (InvalidOperationException ex)
         {
             ConsoleTextBox.Invoke(new Action(() => ConsoleTextBox.AppendText(textToAppend)));
         }
     }
     catch (Exception ex)
     {
         Log.Error(ex.Message, ex);
         throw;
     }
 }