Abdul Moiz
Abdul Moiz

Reputation: 21

Close Application on START Button (Windows Phone 7)

I want my application to be terminated after the "Start" button is clicked on windows phone, I do not know which event is fired by the Start button or how I can override it, thanks!

Upvotes: 0

Views: 199

Answers (2)

Abhishek
Abhishek

Reputation: 1379

The answer is, you can't. Only the user and the OS can close an app. Windows Phone 8 has an Application.Terminate() method, but with Windows Phone 7, you cannot do any such thing.

One hack is to throw some exception in your Application.Deactivated event. Doing so will result in an app crash and eventually close your app, but your app will fail certification at Windows Phone Store.

Upvotes: 0

Vishal
Vishal

Reputation: 537

Try this once -:

PhoneApplicationService.Current.State["isstartnav"] = true;

Verify the above condition and call the below specified method:

if (NavigationService.CanGoBack)
    {
        while (NavigationService.RemoveBackEntry() != null)
        {
            NavigationService.RemoveBackEntry();
        }
    }

This Method will remove the stack entries from the RAM and your app will be removed from the memory.

Upvotes: 1

Related Questions