如何使用Microsoft Reader不使用Microsoft Edge打开PDF?

问题描述 投票:1回答:1

我正在使用C#开发一个Windows应用商店应用。在我的应用程序中,我需要打开一些PDF,之前我用系统的默认PDF开启器打开PDF。我的代码在Windows 8.1中工作正常,因为客户端要求我在Microsoft Reader应用程序上打开这些PDF。在Windows 8.1中,默认的PDF开启应用程序是Microsoft Reader。但是现在在Windows 10 PC默认的PDF开放应用程序是Microsoft Edge。我想以编程方式更改此行为。我希望我的应用程序在Microsoft Reader应用程序中再次打开这些PDF。如何强行打开我的PDF到Reader应用程序?

任何帮助将非常感激。提前致谢!

c# pdf windows-store-apps microsoft-metro windows-10
1个回答
1
投票

您无法强制使用特定应用程序打开PDF(如果未安装其他应用程序,该怎么办?)但您可以设置首选项。 像这样:

// Set the recommended app
var options = new Windows.System.LauncherOptions();
options.PreferredApplicationPackageFamilyName = "Microsoft.Reader_8wekyb3d8bbwe";
options.PreferredApplicationDisplayName = "Reader";

// Launch the URI and pass in the recommended app 
var success = await Windows.System.Launcher.LaunchUriAsync(uriOfPdf, options);
© www.soinside.com 2019 - 2024. All rights reserved.