c# - 如何在 Windows Phone 8 中打开 .txt 和 .docx 以及 .xls 文档

标签 c# windows-phone-8 isolatedstorage app-launcher

如何在 Windows Phone 8 中打开文本文档、.docx 和 .xls 文档, 我将文件保存在独立存储中,然后尝试使用 Launcher.FileAsync 打开但没有得到结果。有关详细信息,请参阅下面的代码:

  string file = "Download.txt";
  IsolatedStorageFileStream isfStream = new IsolatedStorageFileStream(file, FileMode.Create, IsolatedStorageFile.GetUserStoreForApplication());

        isfStream.Close();


        StorageFolder local = Windows.Storage.ApplicationData.Current.LocalFolder;
        StorageFile pdffile = await local.GetFileAsync(file);

        Windows.System.Launcher.LaunchFileAsync(pdffile);

最佳答案

GetFileAsync() 的语法是

public IAsyncOperation<StorageFile> GetFileAsync(string name)

在哪里

名称:要获取的文件的名称(或路径相对于 当前文件夹)。

你的字符串是

string file = "Download.txt";

这可能不被接受为相对路径。尝试类似的东西,

string file = @"\Download.txt";

关于c# - 如何在 Windows Phone 8 中打开 .txt 和 .docx 以及 .xls 文档,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24821870/

相关文章:

c# - 从另一个页面访问 IsolatedStorage Windows Phone 8

c# - 如何在开发时将现有文件添加到 IsolatedStorage?

c# - SQL Azure Federation 和 EF Code First 数据库生成?

c# - 用asp.net 5 应用程序部署源代码有什么好处?

windows-phone-8 - 找不到文件 'Windows.props'

javascript - Windows Phone 8 Cordova HTML5 App 上的触摸会忽略具有较高 z-index 的图层

c# - 更改 IsolatedStorage 位置

c# - 正则表达式不能按我的需要工作

c# - 通过委托(delegate)和事件调用的区别 C#

windows-phone-7 - 在 windows phone 8 中将图像转换为灰度