Silverlight Instance Tutorial

Source: Internet
Author: User
Tags silverlight

Through the previous several learning and practice, I believe you can easily create personalized Silverlight out of the browser application. Last week, on the Silver China web forum, someone asked how to update the Silverlight out of browser application online. This article will address this issue and introduce how Silverlight's out of browser applications are updated online, and we will describe a new out of browser application installation that is provided in Silverlight 4.

First of all, Silverlight out of browser application online update

At the beginning of this series, we have introduced that the Silverlight out of browser and Silverlight Web applications are somewhat different, and the Silverlight Web updates the server-side XAP files after the user is loaded back into the The XAP file is automatically updated to the local temp directory. The automatic update applied by Silverlight out of browser is by calling the Checkanddownloadupdateasync method And application.checkanddownloadupdatecompleted, when the Updateavailable property is judged to be true, a new version has been discovered and successfully downloaded, on the contrary, false. If an exception is found in instrumentation, the exception instance information can be viewed through the error property.

In the usual way, we all update and detect when the application starts, so we need to add the code to the App.xaml constructor,

First create oncheckanddownloadupdatecompleted detect if a new version is allowed to download,

1 private void OnCheckAndDownloadUpdateCompleted(object sender, CheckAndDownloadUpdateCompletedEventArgs e)
2 {
3 if (e.UpdateAvailable && e.Error == null)
4 {
5 MessageBox.Show(" 应用新版本已经下载成功,将在下次启动时生效。");
6 }
7 else if (e.Error != null)
8 {
9 MessageBox.Show("在 检测应用更新时, 在"
10 + "出现以下错误信 息:"
11 + Environment.NewLine
12 + Environment.NewLine
13 + e.Error.Message);
14 }
15 }

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.