comparison FrmMainWindow.cs @ 52:4bad8cb3f889

Re #60: Add UI to add/remove/edit weapons in GTK * Remove "not implemented" exceptions and add first implementation of setting equipment list * Add widgets to add equipment form * Subscribe to Clicked instead of Activated to hook on to correct event * Extract tree rendering method into helper class Also: * Improve exception handling of unhandled exceptions (print full stack trace with "caused by" hierarchy)
author IBBoard <dev@ibboard.co.uk>
date Sun, 22 Aug 2010 14:32:16 +0000
parents 07fd9f7b0dd1
children 293d204e40db
comparison
equal deleted inserted replaced
51:dafbd432ca23 52:4bad8cb3f889
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)).Fatal("(" + ex.GetType().Name + ") " + ex.Message + Environment.NewLine + ex.StackTrace); 93 LogManager.GetLogger(typeof(FrmMainWindow)).FatalFormat("({0}) {1} {2} {3}", ex.GetType().FullName, ex.Message, Environment.NewLine, GetStackTrace(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."); 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 dialog.Show(); 95 dialog.Show();
96 }
97
98 private static string GetStackTrace(Exception ex)
99 {
100 string message = "";
101
102 if (ex != null)
103 {
104 message = "Caused by: " + ex.GetType().FullName + Environment.NewLine + ex.StackTrace + Environment.NewLine + GetStackTrace(ex.InnerException);
105 }
106
107 return message;
96 } 108 }
97 109
98 public FrmMainWindow() : this(new string[0]) 110 public FrmMainWindow() : this(new string[0])
99 { 111 {
100 //Do nothing extra 112 //Do nothing extra