1. 程式人生 > >UWP 重啟App

UWP 重啟App

line .cn gin 引用 狀態 fff 博客 col apps

原文: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

UWP 重啟App