private void LogVisualTB(string sMessage, string sSeverity) { if (TextBlock != null) { var range = new TextRange(TextBlock.ContentEnd, TextBlock.ContentEnd); range.Text += sMessage + "\n"; if (UseColorCoding) { SolidColorBrush brush = null; if (!SeverityColors.TryGetValue(sSeverity, out brush)) { brush = Brushes.Black; } range.ApplyPropertyValue(TextElement.ForegroundProperty, brush); } } }
private void LogVisualRTB(string sMessage, string sSeverity) { if (RichTextBox != null) { var range = new TextRange(RichTextBox.Document.ContentEnd, RichTextBox.Document.ContentEnd); range.Text = "\n" + sMessage; if (UseColorCoding) { SolidColorBrush brush = null; if (!SeverityColors.TryGetValue(sSeverity, out brush)) { brush = Brushes.Black; } range.ApplyPropertyValue(TextElement.ForegroundProperty, brush); } RichTextBox.ScrollToEnd(); } }