protected override void DoTest() { // Show About dialog. RunDlg <AboutDlg>(() => { using (var about = new AboutDlg()) { about.ShowDialog(Program.MainWindow); } }, a => a.Close()); // Show Alert link dialog. RunDlg <AlertLinkDlg>( () => WebHelpers.ShowLinkFailure(Program.MainWindow, "http://skyline.maccosslab.org"), d => d.Close()); // Show shutdown report dialog Assert.IsFalse(ReportShutdownDlg.HadUnexpectedShutdown(true)); try { throw new IOException("Something to report"); } catch (Exception x) { ReportShutdownDlg.SaveExceptionFile(x, true); } Assert.IsTrue(ReportShutdownDlg.HadUnexpectedShutdown(true)); RunDlg <ReportShutdownDlg>(() => { using (var reportShutdownDlg = new ReportShutdownDlg()) { reportShutdownDlg.ShowDialog(SkylineWindow); } }, d => d.Close()); Assert.IsFalse(ReportShutdownDlg.HadUnexpectedShutdown(true)); // Show upgrade dialog RunDlg <UpgradeLicenseDlg>(() => { using (var dlg = new UpgradeLicenseDlg(Program.LICENSE_VERSION_CURRENT - 1)) { dlg.ShowDialog(SkylineWindow); } }, d => d.Close()); // Show import retry dialog (requires some extra work to avoid blocking the counting) var dlgCount = ShowDialog <ImportResultsRetryCountdownDlg>(ShowImportResultsRetryCountdownDlg); // Thread.Sleep(20*1000); OkDialog(dlgCount, dlgCount.Cancel); }
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { // Only the first unhandled exception is reported. lock (_unhandledExceptionLock) { try { ReportShutdownDlg.SaveExceptionFile((Exception)e.ExceptionObject); } // ReSharper disable once EmptyGeneralCatchClause catch (Exception ex) { Trace.WriteLine(ex.ToString()); } // Other threads may continue to execute and cause unhandled exceptions. Kill the process as soon as possible. Process.GetCurrentProcess().Kill(); } }
protected override void DoTest() { // Show About dialog. using (var about = new AboutDlg()) { RunDlg <AboutDlg>( () => about.ShowDialog(Program.MainWindow), a => a.Close()); } // Show Alert link dialog. RunDlg <AlertLinkDlg>( () => WebHelpers.ShowLinkFailure(Program.MainWindow, "http://skyline.maccosslab.org"), d => d.Close()); // Show shutdown report dialog Assert.IsFalse(ReportShutdownDlg.HadUnexpectedShutdown(true)); try { throw new IOException("Something to report"); } catch (Exception x) { ReportShutdownDlg.SaveExceptionFile(x, true); } Assert.IsTrue(ReportShutdownDlg.HadUnexpectedShutdown(true)); using (var reportShutdownDlg = new ReportShutdownDlg()) { RunDlg <ReportShutdownDlg>( () => reportShutdownDlg.ShowDialog(), d => d.Close()); } Assert.IsFalse(ReportShutdownDlg.HadUnexpectedShutdown(true)); // Show upgrade dialog using (var dlg = new UpgradeDlg(Program.LICENSE_VERSION_CURRENT - 1)) { RunDlg <UpgradeDlg>( () => dlg.ShowDialog(), d => d.Close()); } }