问题
I've begun tinkering with making windows 8 apps And I want to make an exit button.
The problem is that Environment.Exit()
and this.Close()
that I'd use in winforms isn't in scope here.
anyone know how to close the app Programmatically?
回答1:
Application.Current.Exit();
But closing a Metro app is not recommended. It is usually suspended.
回答2:
Application.Exit
But be careful. You can fail certification by having code which forcefully closes the App. Make sure to read up on Certification Guidance if you plan to release to the store:
Your app must neither programmatically close nor offer UI affordances to close it. Windows 8 Process Lifetime Management closes Windows Store apps automatically.
回答3:
Application.Current.Exit();
This was not allowed, but requirement 3.6, which used to not allow this, seems to be removed : http://msdn.microsoft.com/en-us/library/windows/apps/hh694083.aspx#acr_changelog
来源:https://stackoverflow.com/questions/12749990/programmatically-close-win8-app