/[AnywhereTS-MSSQL]/trunk/TSAdminTool/Program.cs
ViewVC logotype

Diff of /trunk/TSAdminTool/Program.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- trunk/TSAdminTool/Program.cs	2012/07/12 19:34:37	67
+++ trunk/TSAdminTool/Program.cs	2012/07/12 19:40:36	68
@@ -31,6 +31,7 @@
         }
         static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs args)
         {
+            DialogResult result = DialogResult.Cancel;
             Exception e = (Exception)args.ExceptionObject;
             if (e == null)
             {
@@ -50,8 +51,9 @@
                 strs.Reverse();
                 StringBuilder builder = new StringBuilder();
                 foreach (object str in strs) { builder.AppendLine(str.ToString()); }
-                builder.AppendLine("Encountered unhandled Exception");
-                MessageBox.Show(builder.ToString());
+                result = ShowAbortRetryIgnoreDialog("Encountered unhandled Exception", builder.ToString());
+                if (result == DialogResult.Abort)
+                    Application.Exit();
             }
             else
             {
@@ -65,9 +67,15 @@
                 strs.Reverse();
                 StringBuilder builder = new StringBuilder();
                 foreach (object str in strs) { builder.AppendLine(str.ToString()); }
-                builder.AppendLine("Encountered unhandled Exception");
-                MessageBox.Show(builder.ToString());
+                result = ShowAbortRetryIgnoreDialog("Encountered unhandled Exception", builder.ToString());
+                if (result == DialogResult.Abort)
+                    Application.Exit();
             }
         }
+        // Creates the error message and displays it.
+        private static DialogResult ShowAbortRetryIgnoreDialog(string title, string message)
+        {
+            return MessageBox.Show(message, title, MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Stop, MessageBoxDefaultButton.Button1);
+        }
     }
 }
\ No newline at end of file

 

  ViewVC Help
Powered by ViewVC 1.1.22