public void SetText(string text) { doc.Document.Blocks.Clear(); if (text.StartsWith("<?xml version=\"1.0\"")) { CodeLanguage = NServiceBus.Profiler.Common.CodeParser.CodeLanguage.Xml; } if (text.IsValid()) { var presenter = new CodeBlockPresenter(CodeLanguage); var t = new Paragraph(); if (CodeLanguage == NServiceBus.Profiler.Common.CodeParser.CodeLanguage.Xml) { text = Tools.FormatXml(text); } else if (CodeLanguage == NServiceBus.Profiler.Common.CodeParser.CodeLanguage.Json) { text = Tools.FormatJson(text); } presenter.FillInlines(text, t.Inlines); doc.Document.Blocks.Add(t); } }
public virtual void Display(string message) { if (message == null) { return; } var presenter = new CodeBlockPresenter(CodeLanguage.Json); var paragraph = new Paragraph(); presenter.FillInlines(message, paragraph.Inlines); document.Document.Blocks.Add(paragraph); }