其他分享
首页 > 其他分享> > WinUI get Launched Param, args.UWPLaunchActivatedEventArgs.Kind is aways returning as 'launch&#

WinUI get Launched Param, args.UWPLaunchActivatedEventArgs.Kind is aways returning as 'launch&#

作者:互联网

 

想尝鲜WinUI, 整了个小小的WinUI桌面程序。

想要获取关联文件,通过文件的打开方式启动我的软件,一直取不到启动参数。纠结了一整天,难受死了。尝鲜WinUI的痛苦。

最后用Appinstance的GetActivatedEventArgs().Kind取到想要的参数。

 protected  override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
        {
            //args.UWPLaunchActivatedEventArgs.Kind  //Not this Kind
            Microsoft.Windows.AppLifecycle.AppInstance appInstance =
            Microsoft.Windows.AppLifecycle.AppInstance.GetCurrent();
            var kind = appInstance.GetActivatedEventArgs().Kind;
}

 

标签:Kind,appInstance,get,UWPLaunchActivatedEventArgs,args,WinUI,Microsoft
来源: https://www.cnblogs.com/siazon/p/15835661.html