How to restart an app in UWP?

故事扮演 提交于 2019-12-05 18:57:30

According to a recent blog post, there is a new API for this "from Build 16226 onwards, along with the corresponding SDK."

The new static RequestRestartAsync(String) method and overloads on CoreApplication provide the previously unavailable app restart magic, including the ability to pass arguments to the new instance.

As far as I know there is no way for a UWP app to close itself so that means you cannot restart the app. Looks like you can close an app by using `App.Current.Exit()' but still no way to restart afterwards.

I would actually be looking at why do you need to restart when changing theme. With the way the theming systems is built it should be possible to change everything dynamically. But that might be food for a different question

You can close the app but you can't restart it.

Window.Current.Close();
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!