comparison FrmMainWindow.cs @ 57:293d204e40db

Re #60: Add UI to add/remove/edit weapons in GTK * Make enabling/disabling fit the values passed (copied from existing WinForms checks) * Add extra interface methods and properties to get necessary values from UI to use in command * Implement new interface methods * Implement command execution * Make use of IDisposable interface instead of defining Dispose ourselves Also: * Use existing method of printing exception stack traces in main window
author IBBoard <dev@ibboard.co.uk>
date Thu, 26 Aug 2010 19:30:22 +0000
parents 4bad8cb3f889
children e3fe48c4d794
comparison
equal deleted inserted replaced
56:0c5fbb54bfb0 57:293d204e40db
88 HandleUnhandledException(ex); 88 HandleUnhandledException(ex);
89 } 89 }
90 90
91 private static void HandleUnhandledException(Exception ex) 91 private static void HandleUnhandledException(Exception ex)
92 { 92 {
93 LogManager.GetLogger(typeof(FrmMainWindow)).FatalFormat("({0}) {1} {2} {3}", ex.GetType().FullName, ex.Message, Environment.NewLine, GetStackTrace(ex)); 93 string msg = String.Format("({0}) {1}", ex.GetType().FullName, ex.Message);
94 LogManager.GetLogger(typeof(FrmMainWindow)).Fatal(msg, ex);
94 MessageDialog dialog = new MessageDialog(null, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, false, "An unhandled exception occurred. Please check the log for more details."); 95 MessageDialog dialog = new MessageDialog(null, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, false, "An unhandled exception occurred. Please check the log for more details.");
95 dialog.Show(); 96 dialog.Run();
96 } 97 }
97 98
98 private static string GetStackTrace(Exception ex) 99 private static string GetStackTrace(Exception ex)
99 { 100 {
100 string message = ""; 101 string message = "";
101 102
102 if (ex != null) 103 if (ex != null)
103 { 104 {
104 message = "Caused by: " + ex.GetType().FullName + Environment.NewLine + ex.StackTrace + Environment.NewLine + GetStackTrace(ex.InnerException); 105 message = "Caused by: " + ex.GetType().FullName + Environment.NewLine + ex.StackTrace + Environment.NewLine ;
105 } 106 }
106 107
107 return message; 108 return message;
108 } 109 }
109 110