ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/AnywhereTS-MSSQL/trunk/TSAdminTool/Program.cs
(Generate patch)

Comparing trunk/TSAdminTool/Program.cs (file contents):
Revision 67 by william, Thu Jul 12 19:34:37 2012 UTC vs.
Revision 68 by william, Thu Jul 12 19:40:36 2012 UTC

--- 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 @@ namespace AnywhereTS
         }
         static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs args)
         {
+            DialogResult result = DialogResult.Cancel;
             Exception e = (Exception)args.ExceptionObject;
             if (e == null)
             {
@@ -50,8 +51,9 @@ namespace AnywhereTS
                 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 @@ namespace AnywhereTS
                 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