简体   繁体   English

如何在Windows Phone 8.1 RT中将文件从Assets文件夹导出到手机的Documents文件夹?

[英]How to export a file from the Assets folder to the phone's Documents folder in Windows Phone 8.1 RT?

I'm trying to export a file from the Assets folder to the phone's Documents folder in Windows Phone 8.1 RT using C#. 我正在尝试使用C#将文件从Assets文件夹导出到Windows Phone 8.1 RT中手机的Documents文件夹。 I've enabled documents library capability and able to access Documents Library. 我已启用文档库功能,并能够访问文档库。 But I'm unable to copy a file. 但是我无法复制文件。

Anyone? 任何人?

I haven't tried copying a file from Assets, but I can write out a file to my phone's Documents folder ok: 我没有尝试从Assets复制文件,但是可以将文件写到手机的Documents文件夹中,好:

var myFolder = KnownFolders.DocumentsLibrary;
var myFile = await myFolder.CreateFileAsync("test.txt", CreationCollisionOption.OpenIfExists);
await FileIO.WriteTextAsync(myFile, "hello world");

Do you have the correct File Type Association in the manifest? 清单中是否有正确的文件类型关联? Should be something like: 应该是这样的:

<Extension Category="windows.fileTypeAssociation">
  <FileTypeAssociation Name="txt">
    <DisplayName>txt</DisplayName>
      <SupportedFileTypes>
        <FileType>.txt</FileType>
      </SupportedFileTypes>
  </FileTypeAssociation>
</Extension>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM