/// <summary> /// Print a message to the console. /// </summary> /// <param name="message">The message to be printed.</param> private void WriteText(String message, Brush brush, FontWeight fontWeight) { Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => { var end = RtbConsole.Document.ContentEnd; var r = new TextRange(end, end) { Text = message }; r.ApplyPropertyValue(TextElement.ForegroundProperty, brush); r.ApplyPropertyValue(TextElement.FontWeightProperty, fontWeight); RtbConsole.ScrollToEnd(); })); }
private void WriteToConsole(string message) { Dispatcher?.Invoke(() => { RtbConsole.AppendText(DateTime.Now.ToString("G") + ": " + message + "\r"); }); }