Question about DispatcherUnhandledException
Posted
by
Diego Pacheco
on Stack Overflow
See other posts from Stack Overflow
or by Diego Pacheco
Published on 2011-01-13T21:44:57Z
Indexed on
2011/01/13
21:53 UTC
Read the original article
Hit count: 238
c#
The problem in this code is that when it's run and I push "Yes" button, This is shown:
This means that my application stopped working, I just want it to end.
private void App_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
string message = "An unhandled exception has ocurred, do you want close the app?";
MessageBoxResult currentMB = MessageBox.Show(message, "SomeTitleApp", MessageBoxButton.YesNo, MessageBoxImage.Exclamation);
if (currentMB == MessageBoxResult.Yes)
{ Application.Current.Shutdown(); }
else
{ e.Handled = true; }
}
© Stack Overflow or respective owner