private void ShowUnhandeledException(DispatcherUnhandledExceptionEventArgs e)
{
e.Handled = true;
string errorMessage =
string.Format(
"An application error occurred.\nPlease check whether your data is correct and repeat the action. If this error occurs again there seems to be a more serious malfunction in the application, and you better close it.\n\nError:{0}\n\nDo you want to continue?\n(if you click Yes you will continue with your work, if you click No the application will close)",
e.Exception.Message + (e.Exception.InnerException != null
? "\n" +
e.Exception.InnerException.Message
: null));
Trace.TraceError(errorMessage);
Trace.TraceError("Stack Trace " + e.Exception.StackTrace);
Trace.TraceError("Source " + e.Exception.Source);
Trace.TraceError("Inner Exception3 " + e.Exception.InnerException);
//if (
// MessageBox.Show(errorMessage, "Application Error", MessageBoxButton.YesNoCancel, MessageBoxImage.Error, MessageBoxResult.No) ==
// MessageBoxResult.Yes)
{
{
Application.Current.Shutdown();
}
}
}