using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace ProjectXenocide { /// /// Dialogue that allows copying of exception text to clipboard /// public partial class ErrorDialogue : Form { /// /// Constructor /// /// exception that caused this dialogue to show [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1303:DoNotPassLiteralsAsLocalizedParameters", Justification = "It's debugging code")] public ErrorDialogue(Exception exception) : this() { Cursor.Show(); if (null != exception) { string message = "Exception: " + exception.Message + "\r\nStackTrace:\r\n" + exception.StackTrace; this.txtExceptionText.Text = message; } } /// /// Hidden default constructor /// private ErrorDialogue() { InitializeComponent(); } /// /// Event handler for copy to clipboard button click /// /// object originating event /// event args private void btnCopyToClipboard_Click(object sender, EventArgs e) { Clipboard.SetDataObject(this.txtExceptionText.Text, true); } } }