如何在UWP中重新启动应用程序? [英] How to restart an app in UWP?

查看:114
本文介绍了如何在UWP中重新启动应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前,在我的UWP应用程序中,我提供了一种更改应用程序主题的方法.但是为了使更改生效,用户必须手动关闭应用程序并重新启动它.我正在寻找一种自动执行此操作的方法,即以编程方式重新启动应用程序.

Currently in my UWP application, I provide a way to change the app theme. But in order for the change to be effective, the user has to manually close the app and restart it. I'm looking for a way to do it automatically, ie, restart the app programmatically.

有可能吗?谢谢.

推荐答案

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

新的静态 RequestRestartAsync(String)方法和 CoreApplication 上的重载提供了以前不可用的应用重启魔术,包括将参数传递给新实例的功能.

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.

这篇关于如何在UWP中重新启动应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆