public void AppendText(TextBox block, ScrollViewer scroll, ChatMessage message) { var text = string.Format("[ {0:HH:mm:ss} ] {1}\n", message.Date, message.Message); block.Text += text; if (Model.AutoScroll) scroll.ScrollToEnd(); }
public ScrollViewerAutoScrollToEndHandler(ScrollViewer scrollViewer) { if (scrollViewer == null) throw new ArgumentNullException("scrollViewer"); _scrollViewer = scrollViewer; _scrollViewer.ScrollToEnd(); _scrollViewer.ScrollChanged += ScrollChanged; }
public void AppendText(Paragraph p, ScrollViewer scroll, ChatMessage message) { var text = string.Format("[ {0:HH:mm:ss} ] {1}\n", message.Date, message.Message); var color = ServerMonitorModel.GetMessageColor(message); var brush = new SolidColorBrush(color); var span = new Span() { Foreground = brush }; span.Inlines.Add(text); paragraph.Inlines.Add(span); if (Model.AutoScroll) scroll.ScrollToEnd(); }