public void AddOutputLine(string line) { TxtServiceOutput.Dispatcher.Invoke(new Action(() => { Paragraph paragraph = new Paragraph(new Run(line)); paragraph.Margin = new Thickness(0, 5, 0, 0); TxtServiceOutput.Document.Blocks.Add(paragraph); TxtServiceOutput.ScrollToEnd(); })); }
public void AddOutputLine(string from, string line, Brush color) { TxtServiceOutput.Dispatcher.Invoke(new Action(() => { Paragraph paragraph = new Paragraph(); paragraph.Margin = new Thickness(0, 5, 0, 0); paragraph.Inlines.Add(new Bold(new Run(from + ": ")) { Foreground = color }); paragraph.Inlines.Add(line); TxtServiceOutput.Document.Blocks.Add(paragraph); TxtServiceOutput.ScrollToEnd(); })); }