[UWP]后台下载器恢复 [英] [UWP]Background down-loader Resuming

查看:86
本文介绍了[UWP]后台下载器恢复的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在客户端计算机上使用相同的代码,但是当我们尝试在vs2017中在UWP中运行应用程序时,有些时候恢复工作但是大多数时候它无法恢复资产而不是恢复它的启动作为新的开始。

I have using the same code works in client machine but when we try to run the application in UWP in vs2017 at our end some times resuming works but most of the times it fails to resuming the asset instead resuming it start as fresh start.

我已经深入检查了问题并找到了 

I have checked the issue in deep and found 

DownloadOperation.AttachAsync()

DownloadOperation.AttachAsync()

在调用之前,这些方法完成了资产下载器的一部分,在下载对象的对象中以字节存在,但是当这些方法调用时,重启下载为全新下载。

Before to the call these method completed part of asset downloader exist in bytes in object of DownloadOperation but when these method call it restart the downloading as fresh download.




推荐答案

嗨Gaurav Ahluwalia,

Hi Gaurav Ahluwalia,

Welcome
到开发通用Windows应用论坛!

请阅读粘贴帖子,尤其是

发布指南:主题行标签

Windows 10 SDK和工具的已知问题 

Please read the sticky posts, especially the Guide to posting: subject line tags and Known Issues for Windows 10 SDK and Tools 

我在 $中测试了您的问题b $ b BackgroundTransfer 示例多次,这是Microsoft UWP示例的一部分,但我没有重现它。根据您的说法,调用DownloadOperation.AttachAsync()时会出现问题。在BackgroundTransfer示例中,我启动了一个DownloadOperation
并在完成之前暂停了它。然后我重新打开示例并进入原始页面,其中是示例中调用DownloadOperation.AttachAsync()的唯一位置,并恢复DownloadOperation并正确下载文件。 

I tested your issue in BackgroundTransfer sample several times which is part of Microsoft UWP samples but I didn’t reproduce it. According to what you say, the problem occurs when the DownloadOperation.AttachAsync() is called. In the BackgroundTransfer sample, I started a DownloadOperation and paused it before it is done. Then I reopen the sample and come to original page where is the only place that DownloadOperation.AttachAsync() is called in the sample and resumed the DownloadOperation and the file is downloaded correctly. 


DownloadOperation.AttachAsync()
是:

返回一个异步操作,可用于监视附加下载的进度和完成情况。调用此方法允许应用程序附加在先前应用程序实例中启动的下载操作。

Returns an asynchronous operation that can be used to monitor progress and completion of the attached download. Calling this method allows an app to attach download operations that were started in a previous app instance.

这意味着AttachAsync方法仅用于添加回调方法。

It means the AttachAsync method is only used to add callback method.

请确保您以正确的方式使用它。

Please make sure you are using it in a right way.

我在这里有一些建议:

最后,如果您的问题仍然存在,请您提供一个简单的代码示例给我?您可以从代码项目中删除敏感信息,只需创建一个简单的项目来重现您的问题,之后您可以将样本上传到
OneDrive并与我共享文件。 

At last, if your problem still occurs, could you please provide a simple code sample to me? You can delete the sensitive information from your code project and just create a simple project to reproduce your issue, after that you can upload the sample to the OneDrive and share the file with me. 

最诚挚的问候,

Xavier Eoro

Xavier Eoro


这篇关于[UWP]后台下载器恢复的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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