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://learn.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.
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);
As the OP wrote, when you only have a file path, you can use the following asynchronous code.
using Windows.Storage;
using Windows.System;
// ...
await Launcher.LaunchFileAsync(await StorageFile.GetFileFromPathAsync(path));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With