Automatic update Solution

Source: Internet
Author: User
Because the boss does not allow the use of smart client, you have to download, overwrite, and restart the application. Program Step 3

First, we need a loader program to guide the main program.

Http://files.cnblogs.com/wildfish/AppUpdateStarter.rar

Second, in the main program
// Obtains the assembly of the dock system.

// Case Sensitive

Assembly ASM = Assembly. loadfrom (application. startuppath + Path. directoryseparatorchar +   " SD. dll " );

// Get version information

String Curversion = Versionconfig. getversion (ASM );

// Confirmation window

Form_updateconfirm confirmform =   New Form_updateconfirm ();

// Verify version object

Checkversionsystem checkversion =   New Checkversionsystem (confirmform, " Sdsystem " , Curversion, application. startuppath, False );

Bool Needrestart =   False ;

// Update status window

Form_updatestate stateform =   New Form_updatestate (checkversion );

// Judge version and try to upgrade

Checkversion. tryupdate ( Ref Needrestart );


// If you need to restart

If (Needrestart)

{

Environment. exitcode =   2 ; // The surrounding appstarter must look for this to restart the app.

MessageBox. Show ( " Prompt: the system has been updated! Please restart! " , " Updated " );

}

Else

{

Form_sd_main doc_sd= NewForm_sd_main ();

Application. Run (doc_sd );

}

Step 3: Install the program in the following directory

The Directory of the outer layer, a loader, a configuration file, and a folder of the application.


This is the content in the penavicoxm folder.


In this way, we can control the upgrade of the application system.

Of course, this method has a disadvantage. Users cannot update the system in a timely and effective manner, and the update will be reflected only when they enter the system again.

If you want to use the Smart Client in a timely manner, or use the B/S architecture :)

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.