// вывод сообщений лога void StatusTextBoxTextChanged(object sender, EventArgs e) { StatusTextBox.SelectionStart = StatusTextBox.Text.Length; StatusTextBox.ScrollToCaret(); }
private void LogStatus(string statusMessage, Enum status) { string msg = $"{DateTime.Now.ToString(Config.DateTimeFormat)} {statusMessage}"; if (Configurator.CommandLine) { switch (status) { case Status.SUCCESS: { Console.ForegroundColor = ConsoleColor.Green; break; } case Status.ERROR: { Console.ForegroundColor = ConsoleColor.Red; break; } case Status.WARNING: { Console.ForegroundColor = ConsoleColor.Yellow; break; } case Status.LOG: { Console.ForegroundColor = ConsoleColor.White; break; } default: break; } Configurator.log.AppendLine(msg); Console.WriteLine(msg); Console.ResetColor(); } else { switch (status) { case Status.SUCCESS: { StatusTextBox.Select(StatusTextBox.TextLength, 0); StatusTextBox.SelectionColor = System.Drawing.Color.Green; break; } case Status.ERROR: { StatusTextBox.Select(StatusTextBox.TextLength, 0); StatusTextBox.SelectionColor = System.Drawing.Color.Red; break; } case Status.WARNING: { StatusTextBox.Select(StatusTextBox.TextLength, 0); StatusTextBox.SelectionColor = System.Drawing.Color.DarkOrange; break; } case Status.LOG: { StatusTextBox.Select(StatusTextBox.TextLength, 0); StatusTextBox.SelectionColor = System.Drawing.Color.Black; break; } default: break; } Configurator.log.AppendLine(msg); StatusTextBox.AppendText(msg + Environment.NewLine); StatusTextBox.ScrollToCaret(); this.Refresh(); } }