Ignore:
Timestamp:
Jan 16, 2011, 5:32:40 AM (13 years ago)
Author:
Sam Habiel
Message:

CalendarGrid: Add MouseEnter event: puts focus on calendar grid. Used to "steal" focus from other controls so that lose focus events would fire.
CGDocumentManager: Added application-wide error handler on Application error exception; Added load timer to test how long it takes to load the GUI.
CGDocument: Just documentation updates.

File:
1 edited

Legend:

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

    r1062 r1065  
    173173            AttachConsole(ATTACH_PARENT_PROCESS);
    174174#endif
     175
     176#if TRACE
     177            DateTime startLoadTime = DateTime.Now;
     178#endif
     179
    175180            //Store a class instance of manager. Actual constructor does nothing.
    176181            _current = new CGDocumentManager();
     
    197202            doc.OnNewDocument();
    198203            Application.DoEvents();
     204#if TRACE
     205            DateTime EndLoadTime = DateTime.Now;
     206            TimeSpan LoadTime = EndLoadTime - startLoadTime;
     207            Debug.Write("Load Time for GUI is " + LoadTime.Seconds + " s & " + LoadTime.Milliseconds + " ms\n");
     208#endif
     209            //Application wide error handler for unhandled errors
     210            Application.ThreadException += new ThreadExceptionEventHandler(App_ThreadException);
    199211
    200212            //Run the application
     213            //Sam's Note: This is an unusual way to call this. Typically, it's run with
     214            //the main form as an argument.
    201215            Application.Run();
     216        }
     217
     218        /// <summary>
     219        /// Exception handler for application errors. TODO: Test
     220        /// </summary>
     221        /// <param name="sender"></param>
     222        /// <param name="e"></param>
     223        static void App_ThreadException(object sender, ThreadExceptionEventArgs e)
     224        {
     225            if (e.Exception is System.Net.Sockets.SocketException)
     226            {
     227                MessageBox.Show("Looks like we lost our connection with the server\nClick OK to terminate the application.");
     228                Application.Exit();
     229            }
     230
     231            string msg = "A problem has occured in this applicaton. \r\n\r\n" +
     232                "\t" + e.Exception.Message + "\r\n\r\n" +
     233                "Would you like to continue the application?";
     234
     235            DialogResult res = MessageBox.Show(msg, "Unexpected Error", MessageBoxButtons.YesNo);
     236
     237            if (res == DialogResult.Yes) return;
     238            else Application.Exit();
    202239        }
    203240
Note: See TracChangeset for help on using the changeset viewer.