Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/260.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何在windows phone中检测默认pdfviewer并打开PDF_C#_Pdf_Windows Phone 8_Windows Phone - Fatal编程技术网

C# 如何在windows phone中检测默认pdfviewer并打开PDF

C# 如何在windows phone中检测默认pdfviewer并打开PDF,c#,pdf,windows-phone-8,windows-phone,C#,Pdf,Windows Phone 8,Windows Phone,我正在尝试在WindowsPhone8中下载并打开pdf文件。当任何pdf查看器(Adobe、MS pdf Reader等)出现在手机上时,代码成功运行 protected async void openPDFFile(string path) { try { // Access isolated storage. StorageFolder local = Windows.Storage.ApplicationData.Current.Local

我正在尝试在WindowsPhone8中下载并打开pdf文件。当任何pdf查看器(Adobe、MS pdf Reader等)出现在手机上时,代码成功运行

protected async void openPDFFile(string path)
{
    try
    {
        // Access isolated storage.
        StorageFolder local = Windows.Storage.ApplicationData.Current.LocalFolder;

        // Access the bug query file.
        StorageFile pdfFile = await local.GetFileAsync(path);
        if (pdfFile != null)
        {
            // Launch the pdf file.
            IAsyncOperation<bool> success = Windows.System.Launcher.LaunchFileAsync(pdfFile);

            if (await success)
            {
                // File launched
                System.Diagnostics.Debug.WriteLine("Successfully Open.");
            }
            else
            {
                // File launch failed
                System.Diagnostics.Debug.WriteLine("Failed to open.");
            }
        }
    }
    catch (Exception ex)
    {
        System.Diagnostics.Debug.WriteLine("exception: " + ex.Message);
    }
}
然后打开windows phone系统消息框,是否可以在系统识别之前检测到它,以便在此处显示我自己/自定义创建的消息框?因为在单击windows phone系统消息框时,我希望用户重定向到其他页面

启动fileasync(filepath)
方法之前,是否有任何方法可以检测pdf viewer应用程序是否存在

谁能给我建议一下如何得到解决方案

谁能告诉我如何使用下面的
LaunchFileAsync
?在其声明中,此方法支持的最低电话::Windows phone 8.1。Windows phone 8是否有类似的功能

LaunchFileAsync(IStorageFile, LauncherOptions)

不幸的是,LaunchFileAsync的“true”返回值仅仅意味着启动此文件的尝试已成功执行。如果您通过代码进行调试,您将实际看到异步任务在用户从消息框中选择“是”或“否”之前完成,该消息框在没有可用于打开pdf文件的应用程序时显示


也无法确定手机上是否有PDF查看应用程序,Windows phone 8 SDK不具备此功能,尽管第1方和OEM应用程序似乎有此功能。

谢谢您提供的信息。是否有可能获取系统对话框事件捕获,这意味着我可以从windows phone系统对话框中获取“否单击”。还有一个问题,是否有可能获取windows phone设备上所有已安装应用程序的列表?否,该消息框出现在您的应用程序之外,因此无法确定用户选择的选项。关于你的第二个问题,我在回答中已经提到了,无法查看设备上安装了哪些其他应用程序。如果对您有帮助,请记住将此标记为答案。
LaunchFileAsync(IStorageFile, LauncherOptions)