using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace TIProDevExtension { public partial class MicroProxyDebugDumpViewer : Form { private readonly string _original; public MicroProxyDebugDumpViewer(string body) { _original = body; // body = "x" + body; // Test the exception handler. InitializeComponent(); Text = "Micro Proxy Debug Dump " + DateTime.Now.ToShortTimeString(); try { // From http://stackoverflow.com/questions/16894661/show-formatted-xml-in-textbox string pretty = System.Xml.Linq.XDocument.Parse(body).ToString(); mainTextBox.Text = pretty; } catch (Exception ex) { string pretty = "Exception: " + ex + "\r\n\r\n" + body; mainTextBox.Text = pretty; // The body will be one long line. Let's force it to wrap. mainTextBox.ScrollBars = ScrollBars.Vertical; mainTextBox.WordWrap = true; BackColor = Color.Red; } mainTextBox.Select(0, 0); copyOriginalButton.Select(); } private void copyOriginalButton_Click(object sender, EventArgs e) { Clipboard.SetText(_original); } } }