Automatic component update and seamless installation based on Microsoft Updater Application Block (muab)

Source: Internet
Author: User

Another important feature of Smart Client is how to maintain automatic version updates. Microsoft also provides the corresponding application block, that is, Microsoft Update

Application Block. Next, let's take a look at how to compile the version auto-update function in the application based on our code:
Server configuration.
A. Create a WEB virtual path on the Web server.
B. Separate components of each version to this virtual path.
C. Put a manifest. xml file under the root path of the Web virtual path.
Client configuration.
A. Create an Application Path.
B. beibeiappstart.exe and Its Application configuration file to this path.
C. The information in the muab configuration area of the configuration program of the application is called the response server and client configuration.
Automatically update and seamlessly install programs.
Obtain the muab.
This. gengxinkongzhi = new applicationupdatemanager ();
Register an Application Component update event.
A. gengxinkongzhi. downloadstarted + = new updateractioneventhandler (chengxuxiazaikaishi );
Start the chengxuxiazaikaishi () process of registering the download event to the requirement query control class
 
B. gengxinkongzhi. filesvalidated + = new updateractioneventhandler (chengxuwenjiankeyiyunxing );
Registration requirement for successful download file verification query control class clsxuqiuchaxunkongzhi () chengxuwenjiankeyiyunxing () Process
 
After the component is downloaded and verified, the new program running process is called. First, call the yunxinchengxu () process of xuqiuchaxunform to prompt the user whether to run the new program.

The User agrees to call the yunxingxinchengxu () process of the requirement query control class clsxuqiuchaxunkongzhi. The process is that the county obtains the directory where the update program is located and starts

Run a new process to run the new version of the program, and finally destroy the current running program.
 
C. gengxinkongzhi. updateavailable + = new updateractioneventhandler (chengxuzujiankeyixiazai );
The chengxuzujiankeyixiazai () process of the query control class clsxuqiuchaxunkongzhi of the new version of event registration requirement is detected.
 
The chengxuzujiankeyixiazai () process first determines whether the network is connected, for example, exit offline. Prompt the user whether the new version of the program is available and agree

To stop the component update.
D. gengxinkongzhi. downloadcompleted + = new updateractioneventhandler (chengxuxiazaiwancheng );
After the download is complete, the event is registered in the chengxuxiazaiwancheng () process of the requirement query control class clsxuqiuchaxunkongzhi.
 
Chengxuxiazaiwancheng () calls the xiazaijieshu () Process on the main interface through a delegate event. This function prompts you That the download is complete.
Gengxinkongzhi. filesvalidationfailed + = new updateractioneventhandler (gengxinkongzhi_filesvalidationfailed );
The download file verification failure event is registered in the gengxinkongzhi_filesvalidationfailed () process of the requirement query control class clsxuqiuchaxunkongzhi.
 
A message is displayed, indicating that the download failed.

Start component update.
This. gengxinxc = new thread (New threadstart (this. gengxinkongzhi. startupdater ));
This. gengxinxc. Name = "application update thread ";
Gengxinxc. Start ();

Stop component updates.
 
The process of stopping component update tingzhizujiangengxin () is encapsulated in the requirement control class clsxuqiuchaxunkongzhi. Process:
A. Stop the component Update Service and destroy muab.
This. gengxinkongzhi. stopupdater ();
B. Destroy the component update thread.

 

 

Development Summary
In the process of developing a Smart Client application based on Microsoft application blocks, the technical risks of application implementation are greatly reduced, and our development cycle is also saved. Summary

Application blocks-based development has the following advantages.
1. application blocks provides a comprehensive, systematic, and feasible Smart Client application development solution.
2. Application blocks is very simple to call, and even the use of muab is mainly a configuration process.
3. Application blocks defines a large number of interfaces, providing a lot of space for implementation of possible extensions.
4. Application blocks is provided in open-source mode, which greatly benefits us.
5. Application blocks and. NET Framework are closely integrated.
Using Microsoft application blocks to develop applications is indeed a pleasant process.

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.