如何在Windows Phone 8上打开文件?(How open files on Windows Phone 8?)

编程入门 行业动态 更新时间:2024-10-28 13:18:31
如何在Windows Phone 8上打开文件?(How open files on Windows Phone 8?)

在我的应用程序中,我下载了几种文件(如音频,视频,pdf,powerpoint等)。

所以我从webserver收到这些数据作为byte []对象。

所以我想现在用视频播放器或pdfreader打开它们。

我应该做些什么?

我尝试过这段代码,但我想只有当你的项目文件夹中存有一个文件时才会有效(这不是我的情况)......不是吗?

              // Access the file.
              StorageFile pdfFile = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync("FileToRead.pdf");

              // Launch the pdf file.
              await Windows.System.Launcher.LaunchFileAsync(pdfFile);

In my app I download several kinds of files (like audio,video,pdf,powerpoint,ect) .

So I receive those data from the webserver as byte[] objects.

So I would like to open them with a video player or a pdfreader now.

What am I supposed to do?

I tried this code but I guess it only works if ou have a file stored in your project's folder(that's not my case)...doesn't it?

              // Access the file.
              StorageFile pdfFile = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync("FileToRead.pdf");

              // Launch the pdf file.
              await Windows.System.Launcher.LaunchFileAsync(pdfFile);

                

最满意答案

使用此命令从隔离存储中获取文件

var file = await ApplicationData.Current.LocalFolder.GetFileAsync(filename);

Use this to get a file from Isolated Storage

var file = await ApplicationData.Current.LocalFolder.GetFileAsync(filename);

更多推荐

本文发布于:2023-08-07 03:13:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1461159.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文件   如何在   Windows   Phone   open

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!