private static void Main(string[] args) { #if (!DEBUG) try #endif { log4net.Config.BasicConfigurator.Configure(); Program prog = new Program(); prog.Run(); } #if (!DEBUG) /* In the release build, we hope that no unhandled exceptions occur, but if they do, we would like the user the option to report a bug */ catch(Exception e) { UI.ErrorMessage errorMessage = new UI.ErrorMessage("Application failure", "We're so sorry, but it appears that an unrecoverable error occured :(", e); errorMessage.ShowReportButton = true; errorMessage.Report += delegate { // TODO: send per e-mail or post on getsatisfaction }; errorMessage.ShowDialog(); } #endif }
/// <summary> /// Displays a new ErrorMessage and blocks until it is closed /// </summary> /// <param name="title">The title for the form to be created.</param> /// <param name="message">The message to be displayed to the user.</param> /// <param name="e">The exception that caused the error.</param> public static void Show(string title, string message, Exception e) { ErrorMessage form = new ErrorMessage(title, message, e); form.ShowDialog(); }