private void Console_ConsoleLineEvent(string text, Console.TextType textType) { if (InvokeRequired) { Invoke(new Console.ConsoleLineDelegate(Console_ConsoleLineEvent), text, textType); return; } switch (textType) { case Console.TextType.LOG: toolStripStatusLabel1.Text = "LOG: " + text; toolStripStatusLabel1.ForeColor = System.Drawing.Color.Black; break; case Console.TextType.WARNING: toolStripStatusLabel1.Text = "WARNING: " + text; toolStripStatusLabel1.ForeColor = System.Drawing.Color.Yellow; break; case Console.TextType.ERROR: toolStripStatusLabel1.Text = "ERROR: " + text; toolStripStatusLabel1.ForeColor = System.Drawing.Color.Red; break; } }
void Console_ConsoleLineEvent(string text, Console.TextType textType) { if (InvokeRequired) { Invoke(new Console.ConsoleLineDelegate(Console_ConsoleLineEvent), text, textType); return; } switch (textType) { case Console.TextType.LOG: richTextBox1.SelectionColor = Color.Black; richTextBox1.AppendText(" - LOG: " + text + "\n"); break; case Console.TextType.WARNING: richTextBox1.SelectionColor = Color.Yellow; richTextBox1.AppendText(" - WARNING: " + text + "\n"); break; case Console.TextType.ERROR: richTextBox1.SelectionColor = Color.Red; richTextBox1.AppendText(" - ERROR: " + text + "\n"); break; } }
static void Console_ConsoleLineEvent(string text, Console.TextType textType) { switch (textType) { case Console.TextType.LOG: sw.WriteLine(" - LOG: " + text); break; case Console.TextType.WARNING: sw.WriteLine(" - WARNING: " + text); break; case Console.TextType.ERROR: sw.WriteLine(" - ERROR: " + text); break; } sw.Flush(); }