Ok, so Windows 8 comes with a cool PDF and XLS reader app, called Reader. I have a help document that I want displayed when the user clicks the Help button inside my app. My app should launch the PDF document with whatever is the default viewer for that document type.
But it won't. There are no errors, no exceptions and setting a breakpoint reveals no information. The code I have is:
<Button x:Name="help" Style="{StaticResource HelpAppBarButtonStyle}" Tag="Help" Click="help_Click_1" />
and:
private async void help_Click_1(object sender, RoutedEventArgs e)
{
try
{
Windows.Storage.StorageFile file =
await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync(@"\Assets\User Guide.pdf");
await Windows.System.Launcher.LaunchFileAsync(file);
}
catch (Exception exception)
{
Debug.WriteLine(exception.Message);
}
}
Now, inside solution explorer, there are the usual files and folders. I also have an Assets folder inside the root directory, and the PDF document is located inside this root folder.
I am not sure why this isn't working, but I believe that it may have something to do with how I am pointing to the file in the above code:
await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync(@"\Assets\User Guide.pdf");
How do you correctly display a document contained in the Assets folder with using the default application for that document type?