[UWP] [XAML]如何通过Windows服务启动UWP应用程序? [英] [UWP][XAML] How to start an UWP app through windows service ?

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

问题描述

HI


我创建了一个Windows服务,我打开了一个UWP应用程序,当我运行代码时它工作正常。但是当我安装它并通过cmd提示启动服务时,服务启动并且代码也在运行(通过将内容写入txt文件进行检查)
但我的UWP应用程序无法打开。


以下是代码 -


 流程=新流程()

                {

                    StartInfo = new ProcessStartInfo(@"panasonicdigitalsignage:")

                    {

                        WindowStyle = ProcessWindowStyle.Maximized,

                        WorkingDirectory = Path.GetDirectoryName(@"panasonicdigitalsignage:")

                    }¥b $ b                }; b

               的Process.Start();



UWP的限制是什么?




sandeep chauhan

解决方案


嗨sandeep chauhan,



无法通过调用.exe文件启动UWP应用程序。如果您想要启动UWP应用程序,请使用协议。您可以将协议扩展添加到UWP应用程序,
处理App.xaml.cs中的激活事件。   然后调用Windows RT API

Windows.System.Launcher.LaunchUriAsync(uri)
启动UWP应用程序。



您可以参考此链接获取有关通过URL启动UWP应用程序的更多信息:
< a href ="https://docs.microsoft.com/en-us/windows/uwp/launch-resume/handle-uri-activation">
处理URI激活





最好的问候,



Roy < /跨度>

HI

I created a windows service from where I open an UWP app, its working fine when I running through code. But when I install it and started service through cmd prompt, Service is started and code is also running(checked by write something into a txt file) but my UWP app doesn't open.

Here is the code -

  Process process = new Process()
                {
                    StartInfo = new ProcessStartInfo(@"panasonicdigitalsignage:")
                    {
                        WindowStyle = ProcessWindowStyle.Maximized,
                        WorkingDirectory = Path.GetDirectoryName(@"panasonicdigitalsignage:")
                    }
                };

                process.Start();

Any limitation in UWP for same ?


sandeep chauhan

解决方案

Hi sandeep chauhan,

UWP app could not be launched by calling .exe file. If you want to launch a UWP app, please use Protocol. You could to add Protocol extension to the UWP app and handle the activated event in the App.xaml.cs.  Then call Windows RT API Windows.System.Launcher.LaunchUriAsync(uri) to launch UWP app.

You could refer this link for more information about launch UWP app via URL: Handle URI activation

Best regards,

Roy


这篇关于[UWP] [XAML]如何通过Windows服务启动UWP应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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