本文介绍了c#windows phone下载文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据 []

i创建一个backgroundtransfer。我想在下载完成后,该文件移动到根目录下载文件夹(手机或SD卡/下载)。我不知道怎么做,微软改变了Windows Phone上的所有代码。



microsoft在该主题上写了一段代码>

  case  TransferStatus.Completed:

// 如果已完成转移的状态代码为200或206,则
// 转移成功
if (transfer.StatusCode == 200 || transfer.StatusCode == 206
{
/ / 删除转移请求以便在
// 中腾出空间队列以获得更多转移。转移不会自动
// 被系统删除。
RemoveTransferRequest(transfer.RequestId);

// 在此示例中,下载的文件将移至根
// 隔离存储目录
using (IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForApplication())
{
string filename = transfer.Tag;
if (isoStore.FileExists(filename))
{
isoStore.DeleteFile(filename);
}
isoStore.MoveFile(transfer.DownloadLocation.OriginalString,filename);
}
}







但是我不知道那个文件在哪里搬了!



请给我一个代码。非常感谢

解决方案

Hi, according to http://msdn.microsoft.com/en-us/library/windows/apps/hh202959(v=vs.105).aspx[^]
i create a backgroundtransfer. i want when download is completed, that file moves to "Downloads Folder on root directory" (Phone or SD Card/Downloads). i don't know how can i make it, microsoft changes all codes on Windows Phone.

microsoft wrote a code on that topic>

case TransferStatus.Completed:

  // If the status code of a completed transfer is 200 or 206, the
  // transfer was successful
  if (transfer.StatusCode == 200 || transfer.StatusCode == 206)
  {
    // Remove the transfer request in order to make room in the
    // queue for more transfers. Transfers are not automatically
    // removed by the system.
    RemoveTransferRequest(transfer.RequestId);

    // In this example, the downloaded file is moved into the root
    // Isolated Storage directory
    using (IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForApplication())
    {
      string filename = transfer.Tag;
      if (isoStore.FileExists(filename))
      {
        isoStore.DeleteFile(filename);
      }
      isoStore.MoveFile(transfer.DownloadLocation.OriginalString, filename);
    }
  }




but i dont know where goes that file when moved!

please give me a code. thanks alot

解决方案


这篇关于c#windows phone下载文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 13:58