更新时间:2023-11-21 13:45:34
LaunchUriAsync
不支持在Windows Phone 8%的文档。这将引发称为异常
LaunchUriAsync
isn't supported on Windows Phone 8 per the documentation. It throws an exception if called
您可以使用 Windows.System.Launcher.LaunchFileAsync
推出 StorageFile
。
这代码的工作,例如(assming有一个名为metro.pdf文件
项目,以生成操作
设置为内容
与复制到输出目录
设置为复制如果较新的
)。
This code works for example (assming there's a file called "metro.pdf"
in the project, with the Build Action
set to Content
, with Copy to Output Directory
set to Copy if Newer
).
var installedLocation = Windows.ApplicationModel.Package.Current.InstalledLocation;
var assets = await installedLocation.GetFolderAsync("Assets");
var pdf = await assets.GetFileAsync("metro.pdf");
Windows.System.Launcher.LaunchFileAsync(pdf);