예제 #1
0
        private void InsertRichText(string rtf)
        {
            ChatEdit.AppendRtf(rtf);
            ChatEdit.RemoveEmptyLastParagraph();

            ChatEdit.ScrollToEnd();
        }
예제 #2
0
        private void InsertMessage(string message, Brush foreground)
        {
            Paragraph paragraph = new Paragraph();

            paragraph.Inlines.Add(
                new Run(message)
            {
                FontWeight = FontWeights.Normal,
                Foreground = foreground,
            }
                );

            if (ChatEdit.Document.Blocks.Count == 1)
            {
                ChatEdit.RemoveEmptyLastParagraph();
            }
            ChatEdit.Document.Blocks.Add(paragraph);

            ChatEdit.ScrollToEnd();
        }
예제 #3
0
        private Paragraph InsertHeader(string name, DateTime time, Brush foreground)
        {
            Paragraph paragraph = new Paragraph()
            {
                Foreground = foreground,
                Margin     = new Thickness(0, 5, 0, 0),
            };

            paragraph.Inlines.Add(new Run(name)
            {
                FontWeight = FontWeights.Bold,
            });
            paragraph.Inlines.Add(new Run(@" (" + time.ToShortTimeString() + @"):"));
            paragraph.Inlines.Add(new LineBreak());

            if (ChatEdit.Document.Blocks.Count == 1)
            {
                ChatEdit.RemoveEmptyLastParagraph();
            }
            ChatEdit.Document.Blocks.Add(paragraph);

            return(paragraph);
        }