Options

wp7 and throw new exception for quiting app

iosubiosub Posts: 23 Bronze 1
edited March 10, 2011 2:40PM in SmartAssembly
HI

I'm using a hack to quit the wp7 SL app if the user cancel the login..

this is the code
namespace MSP.Phone.Exceptions
{
public class Custom
{
public class QuitException : Exception { }

public static void Quit()
{
throw new QuitException();
}
}
}

and on the app.xaml.cs

private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
{
if (e.ExceptionObject is MSP.Phone.Exceptions.Custom.QuitException)
return;


if (System.Diagnostics.Debugger.IsAttached)
{
// An unhandled exception has occurred; break into the debugger
System.Diagnostics.Debugger.Break();
}
}

my problem is that I have enable SA reporting, so every time the user cancel the login screen, the SA Reporting catch the execption.

Is there a way to cancel the SA reporting in this situation.. Maybe with a attribute??

Unfortunately WP7 does not have a app.quit option so this is the only way to quit the app.

any solution?

thanks!

Comments

  • Options
    The most recent version of SA catches WPF exceptions and tries whenever possible to let the app *continue* which is what 99% of developers would generally wish to happen.
Sign In or Register to comment.