UWP中的Process.Start [英] Process.Start in UWP

查看:194
本文介绍了UWP中的Process.Start的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从我的UWP应用程序中运行文件(视频,音乐,图片..)。对于WPF,我可以使用 Process.Start(path)方法,但是UWP现在可以使用此方法。我发现可能应该使用 FullTrustProcessLauncher https://docs.microsoft.com/zh-cn/uwp/api/Windows.ApplicationModel.FullTrustProcessLauncher ),但我不知道它是如何工作的。当我只有文件的 path 时,有人可以在这里给我写一些非常示例如何使用它,或如何使用以及解决该问题的方法?谢谢。

I want to run a file (video, music, picture..) from my UWP application. For WPF I can use Process.Start(path) method, but this method is now available for UWP. I found that probably I should use FullTrustProcessLauncher (https://docs.microsoft.com/en-us/uwp/api/Windows.ApplicationModel.FullTrustProcessLauncher), but I don't get how does it work. Can someone write me here some very example how to use it or what else and how can I use for this problem, when I have only a path of the file? Thank you.

推荐答案

我会尝试类似的方法。这将打开一个wmv

I would try something like this. This will open a wmv

 Windows.System.LauncherOptions options = new Windows.System.LauncherOptions();
 options.ContentType = "video/x-ms-wmv";
 Windows.System.Launcher.LaunchUriAsync(new Uri(fileUrl), options);

这篇关于UWP中的Process.Start的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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