Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typo3/2.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 8中C语言的默认应用程序#_C#_Live_Windows Phone 8_Onedrive - Fatal编程技术网

C# 下载并启动windows phone 8中C语言的默认应用程序#

C# 下载并启动windows phone 8中C语言的默认应用程序#,c#,live,windows-phone-8,onedrive,C#,Live,Windows Phone 8,Onedrive,我正在使用Live api下载SkyDrive文件 我的代码有一个下载点击事件,它会触发OnDownloadedCompleted函数。 OnDownloadedCompleted函数将文件复制到“filename” 并调用DefaultLaunch(),它接收“文件名”,并尝试使用windows phone 8中的默认程序启动它 当我执行此代码时(下载的文件是OneNote文件)OneNote将打开,并表示无法打开该文件。 有人能帮我验证这个代码吗 非常感谢 private void btnD

我正在使用Live api下载SkyDrive文件

我的代码有一个下载点击事件,它会触发OnDownloadedCompleted函数。

OnDownloadedCompleted函数将文件复制到“filename”

并调用DefaultLaunch(),它接收“文件名”,并尝试使用windows phone 8中的默认程序启动它

当我执行此代码时(下载的文件是OneNote文件)OneNote将打开,并表示无法打开该文件。

有人能帮我验证这个代码吗

非常感谢

private void btnDownload_Click(object sender, RoutedEventArgs e)
    {

        if (App.Current.LiveSession == null)
        {
            infoTextBlock.Text = "You must sign in first.";
        }
        else
        {
            LiveConnectClient client = new LiveConnectClient(App.Current.LiveSession);
            client.DownloadCompleted += new EventHandler<LiveDownloadCompletedEventArgs>(OnDownloadCompleted);

            client.DownloadAsync("file_id");

        }
    }
默认启动功能的代码为

 async void DefaultLaunch()
    {

        try
        {
            string imageFile = @"File.one";
            var file = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync(imageFile);
            var success = await Windows.System.Launcher.LaunchFileAsync(file);
            if (success)
            {}
            else
            {}
        }
        catch (Exception e)
        {
            Console.WriteLine(e.StackTrace);
            Console.WriteLine(e.ToString());

        }
    }

试试这个教程。。这里给出了如何在windows 8平台中使用live sdk

如何使用
“filename”
“File.one”
相同的文件名?嘿,实际上我尝试使用了一个测试数据,并给出了名称File.one。它实际上是filename.zedray-请您具体说明一下。谢谢你的时间!嘿,我通过在文件id后面添加“/content”来实现代码。现在它可以工作了,但是我无法打开“.onepkg”格式的文件。理想情况下,它们应该在OneNote中打开,但它要求我在商店中查找应用程序。有什么建议/建议吗?谢谢你的帮助!
 async void DefaultLaunch()
    {

        try
        {
            string imageFile = @"File.one";
            var file = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync(imageFile);
            var success = await Windows.System.Launcher.LaunchFileAsync(file);
            if (success)
            {}
            else
            {}
        }
        catch (Exception e)
        {
            Console.WriteLine(e.StackTrace);
            Console.WriteLine(e.ToString());

        }
    }