Fork me on GitHub

UWP 重启App

今天看见了阿迪王的博客,写到了重启App自身的代码,微软终于在16299加进来了

其实就加上一句话

await CoreApplication.RequestRestartAsync(string.Empty);

需要引用

using Windows.ApplicationModel.Core;


函数原型

        //
        // 摘要:
        //     重启应用。
        //
        // 参数:
        //   launchArguments:
        //     要传递到已重启实例的参数。
        //
        // 返回结果:
        //     重启请求的状态。
        [RemoteAsync]
        public static IAsyncOperation<AppRestartFailureReason> RequestRestartAsync(string launchArguments);


还可以传递参数,详情 How to Restart your App Programmatically

 

参考 :

http://edi.wang/post/2017/12/1/restart-uwp-app-programmatically

How to Restart your App Programmatically

posted @ 2017-12-06 17:02  猫叔Vincent  阅读(478)  评论(0编辑  收藏  举报