我是 UWP 的新手。
我正在将文档中的 with 复制到我LaunchFileAsync
的项目中:DisplayApplicationPicker
string imageFile = @"test.pdf";
var file = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync(imageFile);
if (file != null)
{
// Set the option to show the picker
var options = new Windows.System.LauncherOptions();
options.DisplayApplicationPicker = true;
// Launch the retrieved file
bool success = await Windows.System.Launcher.LaunchFileAsync(file, options);
if (success)
{
// File launched
}
else
{
// File launch failed ====> GETTING TO HERE
}
}
else
{
// Could not find file
}
返回值为假。
为什么?
顺便说一句,调用LaunchFileAsync(file)
(不带options
参数)- 在 Edge(我的默认 PDF 应用程序)中打开 pdf 文件。