Launching PDF reader on windows phone 8

后端 未结 3 1427
野性不改
野性不改 2021-01-25 11:54

I\'m trying to launch pdf reader with the code below but it does not work. Can somebody help me?

    private async Task WriteData(string fileN         


        
3条回答
  •  无人及你
    2021-01-25 12:28

    just put the anyFile.pdf in Assets folder, and make its build action to Content, and then Just make the function Async ... and then Put "await" before Windows.System.Launcher.LaunchFileAsync(pdf); it worked fine for me. Nice. See this.

         private async void privacyPolicy_Click(object sender, EventArgs e)
              {
            var installedLocation = Windows.ApplicationModel.Package.Current.InstalledLocation;
            var assets = await installedLocation.GetFolderAsync("Assets");
            var pdf = await assets.GetFileAsync("PrivacyPolicy.pdf");
            await Windows.System.Launcher.LaunchFileAsync(pdf);
        }
    

提交回复
热议问题