Vincent Leung .NET Tech Clips

The latest tech clips from the .NET community

Exit out of a Windows Phone Application


image

Scenarios for needing Exit

The two most common scenarios people cite when asking for an Exit method are because (a) the user failed accept a EULA, login to an account, or something else that renders the application inoperable, or (b) the application is in an unstable state due to unexpected errors, etc. and needs to be shut down.

The solution: Throwing Exceptions to Exit your Silverlight App

Peter Torr has a great blog post here about all the various scenarios you may want to exit a WP7 application and each of their side affects.  I would encourage you to read his post to learn more about this topic

About these ads

October 19, 2010 - Posted by | Phone

2 Comments »

  1. This would be of better help:

    protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
    {
    e.Cancel = true;
    MessageBoxResult res = MessageBox.Show(“Are you sure you want to exit?”, “Exit?”, MessageBoxButton.OKCancel);
    if (res == MessageBoxResult.OK)
    {
    e.Cancel = false;
    base.OnBackKeyPress(e);

    }
    }

    More information at http://austinejei.blogspot.com/2012/06/exiting-wp7-application.html

    Comment by Augustine Adjei | August 22, 2012 | Reply

  2. In wp8 you can exit by
    Application.Current.Terminate();

    Comment by Ian Bugeja | December 19, 2012 | Reply


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: