C# 在Emulator中打开PDF文件

C# 在Emulator中打开PDF文件,c#,wpf,pdf,windows-phone-8,windows-phone,C#,Wpf,Pdf,Windows Phone 8,Windows Phone,我有以下代码: private async void LaunchPDF(string name) { var file = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync(name); if (file != null) { // Set the option to

我有以下代码:

private async void LaunchPDF(string name) 
        {
            var file = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync(name);

            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
                    Debug.WriteLine("File Launched");
                }
                else
                {
                    // File launch failed
                    Debug.WriteLine("File Launched Failed");
                }
            }
            else
            {
                // Could not find file
                Debug.WriteLine("File not found");
            }
        }
此方法在此处调用:

private void longListSelector_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            MyObject item  =  longListSelector.SelectedItem as MyObject;
            LaunchPDF("Data/PDF/" + item.SubTitle + ".pdf");
        }
我正在Windows Phone 8 Emulator上进行测试,当我单击长列表选择器中的项目时,出现以下错误:

{System.ArgumentException: Value does not fall within the expected range.
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at MyApp.Classes.Views.PDFPage.<LaunchPDF>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<ThrowAsync>b__0(Object state)}
如何解决这个问题?我做错了什么

编辑

我也设置了这个,更改它的构建操作

右键单击PDF文档

点击属性


将生成操作从“无”更改为“内容”

至少,您需要使用适当的Windows路径分隔符。LaunchPdF@Data\pdf\+item.SubTitle+.pdf@WiredPairie我也试过了,但仍然不起作用,我怎样才能在emulator上测试它呢?是否打开pdf?当前无法安装应用程序。。。难道你不能访问一个可以测试它的物理设备吗?