Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to programmatically quit my App? (Windows Phone 7)

I'm writing a windows phone 7 app. I have "fatal exception" handling code where I know for sure that the app is totally busted and there's no point in continuing. (I'm hoping I never get here...). Since there's nothing more my app can do other than quit I want the user to be able to close the app.

But I noticed there is no System.Environment.Exit() in the Silverlight 4 SDK for Windows Phone 7. Is there another way to quit the app programmatically?

like image 325
will Avatar asked Oct 22 '10 02:10

will


1 Answers

App Cert Reqt:

5.1.2 Application Termination

The application must handle exceptions raised by the .NET Framework and not terminate unexpectedly. During the certification process, the application is monitored for unexpected termination. An application that terminates unexpectedly fails certification. When handling exceptions, an application must provide a user-friendly error message. You may present a message that is relevant to the context of the application. The application must continue to run and remain responsive to user input after the exception is handled. An application that displays generic or unhelpful error messages will fail certification.

I would recommend you provide any information you feel relevant to the user and then leave the navigation of the device to the user to manage in light of this.

Acknowledging known solutions to provide "Exit" buttons, currently I do not see a compelling reason to implement an "exit" from a WP7 application.

The platform is fully capable of managing closure of apps. The more apps don't provide an exit, the quicker users will become accustomed to not thinking about app house keeping, and let the platform manage it.

The user will just navigate their device using start, back, etc.

If the user wants out of the current app to go do something else quickly - easy - they just hit start.

.Exit(), whilst available for xna, really isn't required anymore either. There was a cert requirement during CTP that games had to provide an exit button. This is now gone.

Non game apps never had the need to implement this.

The more this topic's discussed (and it really has been given a good run around the block), the more the indicators to me suggest there is no need to code an exit.

like image 121
Mick N Avatar answered Oct 05 '22 10:10

Mick N