根据这个话题
http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh202959(v=vs.105).aspx
我正在尝试从列表中下载超过 25 个 mp3 文件,在后台,我做了很多不同的尝试,基本上我尝试传递一个列表,删除下载的文件并再次调用该功能......但不起作用在后台使用应用程序......也许是因为它是一个变量?我应该存储到隔离存储中吗?这是最后的代码:
ObservableCollection<File> remoteFileList = new ObservableCollection<File>();
public void downloadList()
{
if ((remoteFileList.Count > 0) && (BackgroundTransferService.Requests.Count() < 5))
{
File t = remoteFileList.First();
BackgroundTransferRequest transfer = startDownload(t.Name);
transfer.TransferProgressChanged += new EventHandler<BackgroundTransferEventArgs>(transfer_TransferProgressChanged);
remoteFileList.Remove(t);
}
}
public void transfer_TransferStatusChanged(object sender, BackgroundTransferEventArgs e)
{
BackgroundTransferRequest b = e.Request as BackgroundTransferRequest;
System.Diagnostics.Debug.WriteLine(b.TransferStatus);
ProcessTransfer(e.Request);
downloadList();
}