I have an UWP app (published in Windows/Microsoft Store), and I am working in a new update, and I use Template10 in my app, that has dark and light theme, and in Windows 10 Mobile but for the change to be effective, the user has to manually close the app and restart it. Is there any possibility to restart/reboot my application? That is, to close the application alone/automatically and reopen my application automatically?
With the Fall Creators Update (1709) We have introduced a new method on CoreApplication called RequestRestart() that enables this scenario. You will need the 16299 SDK (or later) to access this API.
https://docs.microsoft.com/en-us/uwp/api/windows.applicationmodel.core.coreapplication#Methods_
Here is a blog/sample:
https://blogs.windows.com/buildingapps/2017/07/28/restart-app-programmatically/
You can do this with CoreApplication.RequestRestart
var result = await CoreApplication.RequestRestartAsync("Application Restart Programmatically ");
if (result == AppRestartFailureReason.NotInForeground ||
result == AppRestartFailureReason.RestartPending ||
result == AppRestartFailureReason.Other)
{
var msgBox = new MessageDialog("Restart Failed", result.ToString());
await msgBox.ShowAsync();
}
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