Ignore:
Timestamp:
Mar 29, 2011, 7:34:41 AM (14 years ago)
Author:
Sam Habiel
Message:

Added (maybe) better uncaught Exception handling. We'll see if it works at all.
Release exes, again.

Location:
Scheduling/trunk/cs/bsdx0200GUISourceCode
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • Scheduling/trunk/cs/bsdx0200GUISourceCode/CGDocument.cs

    r1117 r1122  
    12961296        }
    12971297
     1298        //DON'T USE OBVIOUSLY. JUST FOR TESTING.
     1299        public void ThrowException()
     1300        {
     1301            throw new Exception("Hello World. I am an Exception.");
     1302        }
     1303
    12981304        #endregion Methods
    12991305
  • Scheduling/trunk/cs/bsdx0200GUISourceCode/CGDocumentManager.cs

    r1121 r1122  
    186186        static void Main(string[] args)
    187187        {
     188            //Application wide error handler for unhandled errors (later I figure out that's only for WinForm ex'es)
     189            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.ThrowException);
     190            Application.ThreadException += new ThreadExceptionEventHandler(App_ThreadException);
     191
     192            // Add the event handler for handling non-UI thread exceptions to the event.
     193            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(App_DomainException);
     194
    188195#if DEBUG
    189196            // Print console messages to console if launched from console
     
    231238            Application.DoEvents();
    232239
    233             //Application wide error handler for unhandled errors
    234             Application.ThreadException += new ThreadExceptionEventHandler(App_ThreadException);
     240            //test
     241            //doc.ThrowException();
     242            //test
    235243
    236244#if TRACE
     
    247255
    248256        /// <summary>
    249         /// Exception handler for application errors. TODO: Test
    250         /// </summary>
     257        /// Exception handler for application errors. Only for WinForm Errors.
     258        /// </summary>
     259        /// <remarks>Never tested. I can't get an error to go here!</remarks>
    251260        /// <param name="sender"></param>
    252261        /// <param name="e"></param>
    253262        static void App_ThreadException(object sender, ThreadExceptionEventArgs e)
    254263        {
    255             if (e.Exception is System.Net.Sockets.SocketException)
    256             {
    257                 MessageBox.Show("Looks like we lost our connection with the server\nClick OK to terminate the application.");
    258                 Application.Exit();
    259             }
    260 
    261264            string msg = "A problem has occured in this applicaton. \r\n\r\n" +
    262265                "\t" + e.Exception.Message + "\r\n\r\n" +
     
    269272        }
    270273
     274        /// <summary>
     275        /// If we are here, we are dead meat.
     276        /// </summary>
     277        /// <param name="sender"></param>
     278        /// <param name="e"></param>
     279        static void App_DomainException(object sender, UnhandledExceptionEventArgs e)
     280        {
     281            if (e.ExceptionObject is System.Net.Sockets.SocketException)
     282            {
     283                MessageBox.Show("Looks like we lost our connection with the server\nClick OK to terminate the application.");
     284            }
     285            else
     286            {
     287                Exception ex = e.ExceptionObject as Exception;
     288
     289                string msg = "A problem has occured in this applicaton. \r\n\r\n" +
     290                    "\t" + ex.InnerException.Message;
     291
     292                MessageBox.Show(msg, "Unexpected Error");
     293            }
     294        }// here application terminates
    271295
    272296        #region BMXNet Event Handler
  • Scheduling/trunk/cs/bsdx0200GUISourceCode/ClinicalScheduling.csproj.user

    r1121 r1122  
    3737    </RemoteDebugMachine>
    3838    <StartAction>Project</StartAction>
    39     <StartArguments>/s=192.168.56.101 /p=9260 /a=shabiel12 /v=catdog.77</StartArguments>
     39    <StartArguments>
     40    </StartArguments>
    4041    <StartPage>
    4142    </StartPage>
  • Scheduling/trunk/cs/bsdx0200GUISourceCode/ClinicalScheduling.sln

    r1120 r1122  
    1111        EndGlobalSection
    1212        GlobalSection(ProjectConfigurationPlatforms) = postSolution
    13                 {8C05C4F7-FE81-479F-87A0-44E04C7F6E0F}.Debug|Any CPU.ActiveCfg = Release|Any CPU
    14                 {8C05C4F7-FE81-479F-87A0-44E04C7F6E0F}.Debug|Any CPU.Build.0 = Release|Any CPU
     13                {8C05C4F7-FE81-479F-87A0-44E04C7F6E0F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
     14                {8C05C4F7-FE81-479F-87A0-44E04C7F6E0F}.Debug|Any CPU.Build.0 = Debug|Any CPU
    1515                {8C05C4F7-FE81-479F-87A0-44E04C7F6E0F}.Release|Any CPU.ActiveCfg = Release|Any CPU
    1616                {8C05C4F7-FE81-479F-87A0-44E04C7F6E0F}.Release|Any CPU.Build.0 = Release|Any CPU
    17                 {DE8E4CC9-4F3A-4E32-8DFE-EE5692E8FC45}.Debug|Any CPU.ActiveCfg = Release|Any CPU
    18                 {DE8E4CC9-4F3A-4E32-8DFE-EE5692E8FC45}.Debug|Any CPU.Build.0 = Release|Any CPU
     17                {DE8E4CC9-4F3A-4E32-8DFE-EE5692E8FC45}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
     18                {DE8E4CC9-4F3A-4E32-8DFE-EE5692E8FC45}.Debug|Any CPU.Build.0 = Debug|Any CPU
    1919                {DE8E4CC9-4F3A-4E32-8DFE-EE5692E8FC45}.Release|Any CPU.ActiveCfg = Release|Any CPU
    2020                {DE8E4CC9-4F3A-4E32-8DFE-EE5692E8FC45}.Release|Any CPU.Build.0 = Release|Any CPU
Note: See TracChangeset for help on using the changeset viewer.