OSDN Git Service

AppliStation-GUI,インストール除外リストの設定を設定ダイアログに追加
[applistation/AppliStation.git] / AppliStation / AppliStation.Util / ExceptionDialogForm.cs
1 using System;\r
2 using System.Drawing;\r
3 using System.Windows.Forms;\r
4 \r
5 namespace AppliStation.Util\r
6 {\r
7         /// <summary>\r
8         /// Description of ExceptionDialogForm.\r
9         /// </summary>\r
10         public partial class ExceptionDialogForm : Form\r
11         {\r
12                 public ExceptionDialogForm()\r
13                 {\r
14                         //\r
15                         // The InitializeComponent() call is required for Windows Forms designer support.\r
16                         //\r
17                         InitializeComponent();\r
18                 }\r
19                 \r
20                 public static void Application_ThrowException(Exception e)\r
21                 {\r
22                         try {\r
23                                 ExceptionDialogForm form = new ExceptionDialogForm();\r
24                                 if (e != null) {\r
25                                         form.detailTextBox.Text = e.ToString() + System.Environment.NewLine + e.StackTrace;\r
26                                 } else {\r
27                                         form.viewDetailButton.Visible = false;\r
28                                 }\r
29                                 \r
30                                 switch (form.ShowDialog()) {\r
31                                         case DialogResult.Cancel:\r
32                                                 return;\r
33                                         default:\r
34                                                 Application.Exit();\r
35                                                 break;\r
36                                 }\r
37                         } catch {\r
38                                 MessageBox.Show("\8fd\91å\82È\83G\83\89\81[\82ª\94­\90\82µ\82½\82Ì\82Å\8fI\97¹\82µ\82Ü\82·\81B\n" + e.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);\r
39                                 Application.Exit();\r
40                         }\r
41                 }\r
42                 \r
43                 public static void Application_ThrowException(object sender, System.Threading.ThreadExceptionEventArgs e)\r
44                 {\r
45                         Application_ThrowException(e.Exception);\r
46                 }\r
47                 \r
48                 public static void Application_ThrowException(object sender, UnhandledExceptionEventArgs e)\r
49                 {\r
50                         Application_ThrowException((Exception) e.ExceptionObject);\r
51                 }\r
52                 \r
53                 void ViewDetailLabelLinkClicked(object sender, EventArgs e)\r
54                 {\r
55                         this.detailTextBox.Visible = true;\r
56                         this.viewDetailButton.Enabled = false;\r
57                         this.Size = new Size(this.Size.Width, this.Size.Height + 250);\r
58                 }\r
59                 \r
60                 void Form_Shown(object sender, EventArgs e)\r
61                 {\r
62                         this.quitButton.Focus();\r
63                 }\r
64         }\r
65 }\r