问题描述
我想从我的 UWP 应用程序运行文件(视频、音乐、图片......).对于 WPF,我可以使用 Process.Start(path)
方法,但此方法现在可用于 UWP.我发现我可能应该使用 FullTrustProcessLauncher
(https://docs.microsoft.com/en-us/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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!