static void WritePlayerStatsError(object sender, PopulatingStatsErrorEventArgs e) { var old_color = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine($"{e.TimeError}: {e.Message}"); Console.ForegroundColor = old_color; }
void WritePlayerStatsError(object sender, PopulatingStatsErrorEventArgs e) { int length = outputBox.TextLength; // at end of text var message = $"{ e.TimeError}: { e.Message}" + Environment.NewLine; outputBox.AppendText(message); outputBox.SelectionStart = length; outputBox.SelectionLength = message.Length; outputBox.SelectionColor = Color.Red; outputBox.DeselectAll(); }