Пример #1
0
 public static void LogMessage(string message, ConsoleColor consoleColor)
 {
     MainForm.Instance.Invoke(
         new MethodInvoker(
             delegate
     {
         var messageColor = consoleColor.DrawingColor();
         int length       = MainForm.Instance.richTextBox1.TextLength;    // at end of text
         MainForm.Instance.richTextBox1.AppendText($">   {message}\n");
         MainForm.Instance.richTextBox1.SelectionStart  = length;
         MainForm.Instance.richTextBox1.SelectionLength = 5 + message.Length;
         MainForm.Instance.richTextBox1.SelectionColor  = messageColor;
         MainForm.Instance.richTextBox1.SelectionLength = 0;
     }));
 }