public void Log(string toString)
{
// _log is the name property of the RichTextBox on the bottom of MainForm
// Sync is an extension method we added to this MainForm control (below) that takes a C# Action delegate
_log.Sync(() =>
{
var format = string.Format("{0:HH:mm:ss} {1}{2}", DateTime.UtcNow, toString, Environment.NewLine);
// append the formatted string the RichTextBox and scroll down
_log.AppendText(format);
_log.ScrollToCaret();
});
}