Exemplo n.º 1
0
 public void Log(string message)
 {
     if (string.IsNullOrEmpty(message))
     {
         return;
     }
     if (label.Text.Length >= maxChars)
     {
         int idx = label.Text.Length % maxChars;
         label.Text = label.Text.ToString().Substring(idx, maxChars - idx);
     }
     label.Bounds         = TextFormatter.CalcRect(0, 0, $"{label.Text}\n{message}");
     scroll.ContentSize   = TextFormatter.CalcRect(0, 0, $"{label.Text}\n{message}").Size;
     scroll.ContentOffset = new Point(0, scroll.ContentSize.Height - (TextFormatter.CalcRect(0, 0, message).Height * 2 + 5));
     label.Text           = $"{label.Text}\n{message}";
     File.AppendAllText("Log", $"\n{message}");
 }