没有BackgroundDownloadAsync事件? [英] No BackgroundDownloadAsync Events?

查看:47
本文介绍了没有BackgroundDownloadAsync事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在编写一个Windows Phone 8应用程序(在VB.NET中,而不是c#),它将下载有声读物文件(mp3文件在 来自用户skydrive的那一刻)这个想法是我将文件存储在本地存储中并且有一些方法可以将它们加入书签
,这样用户就可以继续阅读它们停止的位置。


我已经设置了访问权限到Skydrive并有一个机制来浏览skydrive文件夹并获取构成有声读物的文件夹列表。


我为下载中的每个文件启动了BackgroundDownloadAsync任务。下载每个文件时,我需要复制到本地存储。我还想要某种UI来显示下载进度。


我遇到的问题是我无法将事件处理程序分配给BackGroundDownloadProcessChanged或者BackgroundDownloadCompleted。我得到'BackgroundDownloadCompleted不是Microsoft.Live.LiveConnectClient的成员'错误。


这是一段代码片段:



等待client.BackgroundDownloadAsync(itm.ID&
" / content"
Uri " / shared / transfers /" & ;
itm.Filename,
UriKind .RelativeOrAbsolute),
System.Threading。 CancellationToken
progressHandler )



客户端是一个LiveConnectClient。它是一个包含SkyDriveFile详细信息的类。


任何想法为什么?这是VB.NET问题吗? / p>

谢谢











解决方案

最新版本的Live SDK提供任务异步/等待模式界面。不再支持基于异步语法。


以下是代码的示例:
http://msdn.microsoft.com/en-us/library/live/hh826531.aspx#downloading_files


谢谢,




Hi,

I'm writing a Windows Phone 8 application (in VB.NET, not c#) that will download audiobook files (mp3 files at the moment) from a users skydrive. The idea being that I store the files in local storage and have some way of bookmarking them so the user can resume reading where they left off.

I've set up access to Skydrive and have a mechanism for browsing skydrive folders and getting a list of folders which constitute an audiobook.

I kick off a BackgroundDownloadAsync task for each file in the download. When each file downloads I'll need to copy to local storage. I also want some sort of UI to show download progress.

The problem I have is that I cannot assign event handlers to BackGroundDownloadProcessChanged or BackgroundDownloadCompleted. I get a 'BackgroundDownloadCompleted is not a member of Microsoft.Live.LiveConnectClient' error.

Here is a code snippet:

Await client.BackgroundDownloadAsync(itm.ID & "/content", NewUri("/shared/transfers/"& itm.Filename, UriKind.RelativeOrAbsolute), NewSystem.Threading.CancellationToken, progressHandler)

client is a LiveConnectClient. itm is a class that holds details of the SkyDriveFile.

Any ideas why? Is it a VB.NET issue?

Thanks

解决方案

The latest version of Live SDK provides task async/await pattern interface. The event-based async syntax is not supported anymore.

Here is an example how the code should look like: http://msdn.microsoft.com/en-us/library/live/hh826531.aspx#downloading_files

Thanks,

Lin


这篇关于没有BackgroundDownloadAsync事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆