如何在 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/