简体   繁体   English

CheckAndDownloadUpdateAsync如何真正在后台运行?

[英]How does CheckAndDownloadUpdateAsync actually work behind the scenes?

它会下载所有二进制文件还是仅下载一部分二进制文件,以便评估二进制文件是否为新版本?

In short, it evaluates the XAP, which contains all binaries, but if the version on the XAP hasn't changed it doesn't see any changes. 简而言之,它会评估包含所有二进制文件的XAP,但是如果XAP上的版本未更改,则不会看到任何更改。

Here is a bit more light on that method (lifted from here but pasted for historical reasons): 下面是该方法的更多信息(从此处取消,但出于历史原因粘贴):

Features: 特征:

• Detect network connectivity (and sometimes it fails miserably…) •检测网络连接(有时会严重失败...)

• Connect to the original authorized URL that it was installed from •连接到其原始安装地址

• Download the new XAP file and compare the current version against the downloaded version from the manifest •下载新的XAP文件,并将当前版本与清单中的下载版本进行比较

• Detect the current Silverlight version vs. the new version's Silverlight version •检测当前的Silverlight版本与新版本的Silverlight版本

• If a failure occurs, failure exception types are provided for recovery such as “PlatformNotSupportedException” •如果发生故障,则会提供故障异常类型以进行恢复,例如“ PlatformNotSupportedException”

Limitations: 限制:

• Can't interrupted the request. •无法中断请求。 So when it times out, we wait for it. 因此,当超时时,我们等待它。

• Can't download the update and make it optional to install and replace the currently running XAP. •无法下载更新,并使其成为可选的安装和替换当前正在运行的XAP。 A flag to just detect a newer version would be better. 仅检测较新版本的标记会更好。 This would allow the UI to show the current version and available update version. 这将允许UI显示当前版本和可用更新版本。

• Returns a false for the “UpdateAvailable” property for several reasons such as the new XAP is not signed, is a newer Silverlight Version, or various other errors. •由于多种原因(例如,未签名新XAP,是较新的Silverlight版本或其他各种错误),对“ UpdateAvailable”属性返回false。 We must then look at ALL of the possible error class types placed in the error collection. 然后,我们必须查看放置在错误集合中的所有可能的错误类类型。 A bunch of try-catches are therefore necessary. 因此,需要大量尝试。 The try-catches do the job as long as we have every possible error type in a catch. 只要我们在catch中具有每种可能的错误类型,try-catches就能完成工作。 An enum for the actual error reason may be better. 出于实际错误原因的枚举可能更好。

• Can't revert to a previous stable version and have it install over a newer bad version. •无法还原到先前的稳定版本,并且无法将其安装在较新的错误版本上。 It makes sense, but real development teams have recovery plans when updating production versions. 这是有道理的,但是实际的开发团队在更新生产版本时会有恢复计划。

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

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