Example #1
0
        private static object PropertyRichTextCoerceValueCallback(DependencyObject d, object baseValue)
        {
            RichTextBox rtb       = d as RichTextBox;
            LogInfoArgs container = baseValue as LogInfoArgs;

            AppendText(rtb, container);
            return(baseValue);
        }
Example #2
0
        public static void AppendText(RichTextBox box, LogInfoArgs container)
        {
            if (container == null || string.IsNullOrEmpty(container.Message))
            {
                return;
            }
            Paragraph p = box.Document.Blocks.FirstBlock as Paragraph;

            p.LineHeight = 0.1;

            TextRange tr = new TextRange(box.Document.ContentEnd, box.Document.ContentEnd);

            tr.Text = string.Format("{0}: {1}{2}", DateTime.Now.ToString(), container.Message, Environment.NewLine);
            if (container.Status == LogStatus.Error)
            {
                BrushConverter bc = new BrushConverter();
                tr.ApplyPropertyValue(TextElement.ForegroundProperty, bc.ConvertFromString(RREdColor));
            }
            box.ScrollToEnd();
        }
 private void OnLoggingEvent(object sender, LogInfoArgs e)
 {
     TextStatusContainer = e;
 }