static void UnhandledExceptionTrapper(object sender, UnhandledExceptionEventArgs e) { try { Device dd = leoApp.getDevice(); Reporting report = new Reporting(); if (dd == null) { report.Sendreport("Application has to finish", (Exception)e.ExceptionObject, leoApp.getDevice(), null, 138453); } else { report.Sendreport("Application has to finish", (Exception)e.ExceptionObject, leoApp.getDevice(), leoApp.getDevice().getLogger(), 138454); } } catch (Exception ex) { MessageBox.Show("It is really bad\r\nno chance to recover anything\r\nSorry!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { Environment.Exit(1); } }
static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e) { try { Device dd = leoApp.getDevice(); Reporting report = new Reporting(); if (dd == null) { report.Sendreport("Application has to finish UI error", e.Exception, dd, null, 138351); } else { report.Sendreport("Application has to finish UI error", e.Exception, dd, leoApp.getDevice().getLogger(), 138352); } } catch (Exception ex) { MessageBox.Show("It is really bad\r\nno chance to recover anything\r\nSorry!\r\n" + ex.GetType(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { Environment.Exit(1); } }