I'm building an application for Windows 8 and need to be able to close it programmatically using an action. For example, a button on my application.
I'm building my application using HTML5
The following event handler worked for me...I actually put an Exit icon in a global app bar...users love it!
private void closeButton_Click(object sender, RoutedEventArgs e)
{
App.Current.Exit();
}
Good Luck!
This solution above works for C#...it's especially helpful when using Windows 8 Store Apps on machines that are not touch screen capable (our users were having difficulty emulating the top down swipe to close an app...other users are running a Windows 8 on a Mac VM which makes the Alt + F4 tough)
You cannot. The Windows Runtime API (and the modern subset of the windows SDK) don't provide mechanisms to terminate applications.
The model for Windows Runtime based applications is to allow the system or the user to manage the process lifetime.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With