/// <summary> /// Initialize w/ required values /// </summary> public DisplayableExceptionDisplayForm(Exception exception) { // // Required for Windows Form Designer support // InitializeComponent(); this.labelMessage.Font = Res.GetFont(FontSize.Large, FontStyle.Bold); this.buttonOK.Text = Res.Get(StringId.OKButtonText); // initialize controls Icon = ApplicationEnvironment.ProductIcon; pictureBoxIcon.Image = errorBitmap; DisplayableException displayableException = exception as DisplayableException; if (displayableException != null) { Text = EnsureStringValueProvided(displayableException.Title); labelMessage.Text = EnsureStringValueProvided(displayableException.Title); textBoxDetails.Text = EnsureStringValueProvided(displayableException.Text); // log the error Trace.WriteLine(String.Format(CultureInfo.InvariantCulture, "DisplayableException occurred: {0}", displayableException.ToString())); } else { // log error Trace.WriteLine("Non DisplayableException-derived exception thrown. Subsystems need to handle these exceptions and convert them to WriterExceptions:\r\n" + exception.ToString()); // give the user a full data dump Text = Res.Get(StringId.UnexpectedErrorTitle); labelMessage.Text = exception.GetType().Name; textBoxDetails.Text = exception.ToString(); } }