private void ShowUnhandeledException(DispatcherUnhandledExceptionEventArgs e) { e.Handled = true; Log.Error("Unhandled error ", e.Exception); string errorMessage = string.Format( TranslationStrings.LabelUnHandledError, e.Exception.Message + (e.Exception.InnerException != null ? "\n" + e.Exception.InnerException.Message : null)); // check if wia 2.0 is registered // isn't a clean way if (errorMessage.Contains("{E1C5D730-7E97-4D8A-9E42-BBAE87C2059F}")) { MessageBox.Show(TranslationStrings.LabelWiaNotInstalled); PhotoUtils.RunAndWait("regwia.bat", ""); MessageBox.Show(TranslationStrings.LabelRestartTheApplication); Application.Current.Shutdown(); } else if (e.Exception.GetType() == typeof (OutOfMemoryException)) { Log.Error("Out of memory. Application exiting "); MessageBox.Show(TranslationStrings.LabelOutOfMemory); if (Current != null) Current.Shutdown(); } else { if (MessageBox.Show(TranslationStrings.LabelAskSendLogFile, TranslationStrings.LabelApplicationError, MessageBoxButton.YesNo, MessageBoxImage.Error) == MessageBoxResult.Yes) { var wnd = new ErrorReportWnd("Application crash " + e.Exception.Message, e.Exception.StackTrace); wnd.ShowDialog(); } if ( MessageBox.Show(errorMessage, TranslationStrings.LabelApplicationError, MessageBoxButton.YesNo, MessageBoxImage.Error) == MessageBoxResult.No) { if (Current != null) Current.Shutdown(); } } }
private void mnu_send_log_Click(object sender, RoutedEventArgs e) { var wnd = new ErrorReportWnd("Log file"); wnd.ShowDialog(); }