O'Reilly logo

Windows® Phone 8 Unleashed by Daniel Vaughan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Programmatically Exiting an App

Prior to Windows Phone 8, the only way to programmatically exit a XAML-based app was to raise and not handle an exception. It was an inelegant hack for a not-uncommon scenario.

In Windows Phone 8, however, the API includes a direct mechanism for terminating an app. It is achieved using the Application class’s Terminate method, as demonstrated:

Application.Current.Terminate();

Note

Use the Terminate method only when the user is unable to make any useful forward progress. For example, if the user is presented with an End User License Agreement and declines it, the app may choose to terminate. Or if the app requires the user to log in and the user cannot provide valid credentials, the app may display a message and ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required