[1146] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
| 3 | using System.ComponentModel;
|
---|
| 4 | using System.Data;
|
---|
| 5 | using System.Drawing;
|
---|
| 6 | using System.Text;
|
---|
| 7 | using System.Windows.Forms;
|
---|
| 8 |
|
---|
| 9 | namespace IndianHealthService.BMXNet.WinForm.Forms
|
---|
| 10 | {
|
---|
| 11 | internal partial class ExceptionMessageDialog : System.Windows.Forms.Form
|
---|
| 12 | {
|
---|
| 13 | public ExceptionMessageDialog()
|
---|
| 14 | {
|
---|
| 15 | InitializeComponent();
|
---|
| 16 | }
|
---|
| 17 |
|
---|
| 18 | private Exception _problem = null;
|
---|
| 19 |
|
---|
| 20 | public Exception Problem
|
---|
| 21 | {
|
---|
| 22 | get { return _problem; }
|
---|
| 23 | set { _problem = value; }
|
---|
| 24 | }
|
---|
| 25 |
|
---|
| 26 |
|
---|
| 27 | private void CfShowExceptionDialog_Load(object sender, EventArgs e)
|
---|
| 28 | {
|
---|
| 29 | //this.Problem.Data
|
---|
| 30 | //this.Problem.InnerException
|
---|
| 31 | //this.Problem.Message
|
---|
| 32 | //this.Problem.Source
|
---|
| 33 | //this.Problem.StackTrace
|
---|
| 34 | this.stackTraceTextBox.Text = this.Problem.StackTrace;
|
---|
| 35 | this.exceptionTextBox.Text = this.Problem.Message;
|
---|
| 36 |
|
---|
| 37 | this.innerExceptionButton.Enabled = this.Problem.InnerException != null;
|
---|
| 38 |
|
---|
| 39 | }
|
---|
| 40 |
|
---|
| 41 | private void copyButton_Click(object sender, EventArgs e)
|
---|
| 42 | {
|
---|
| 43 |
|
---|
| 44 | }
|
---|
| 45 |
|
---|
| 46 | private void innerExceptionButton_Click(object sender, EventArgs e)
|
---|
| 47 | {
|
---|
| 48 | ExceptionMessageDialog.SafeShow(this.Text, this.Problem.InnerException);
|
---|
| 49 |
|
---|
| 50 | }
|
---|
| 51 | internal static void MessageBox(string aTitle, string aBody, Exception anException)
|
---|
| 52 | {
|
---|
| 53 | //Show a message box with "Details..." buttons
|
---|
| 54 |
|
---|
| 55 | if (anException == null)
|
---|
| 56 | return;
|
---|
| 57 |
|
---|
| 58 | ExceptionMessageDialog dialog = new ExceptionMessageDialog();
|
---|
| 59 | dialog.Text = aTitle ?? dialog.Text;
|
---|
| 60 | dialog.Problem = anException;
|
---|
| 61 | dialog.ShowDialog();
|
---|
| 62 | }
|
---|
| 63 |
|
---|
| 64 | internal static void SafeShow(string aTitle, Exception anException)
|
---|
| 65 | {
|
---|
| 66 | if (anException == null)
|
---|
| 67 | return;
|
---|
| 68 |
|
---|
| 69 | ExceptionMessageDialog dialog = new ExceptionMessageDialog();
|
---|
| 70 | dialog.Text = aTitle ?? dialog.Text;
|
---|
| 71 | dialog.Problem = anException;
|
---|
| 72 | dialog.ShowDialog();
|
---|
| 73 | }
|
---|
| 74 | }
|
---|
| 75 | }
|
---|