- Timestamp:
- Jan 16, 2011, 5:32:40 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Scheduling/trunk/cs/bsdx0200GUISourceCode/CGDocumentManager.cs
r1062 r1065 173 173 AttachConsole(ATTACH_PARENT_PROCESS); 174 174 #endif 175 176 #if TRACE 177 DateTime startLoadTime = DateTime.Now; 178 #endif 179 175 180 //Store a class instance of manager. Actual constructor does nothing. 176 181 _current = new CGDocumentManager(); … … 197 202 doc.OnNewDocument(); 198 203 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); 199 211 200 212 //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. 201 215 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(); 202 239 } 203 240
Note:
See TracChangeset
for help on using the changeset viewer.