3

Well, its a known fact that when we double-click on the clickonce installed application, a "clickonce screen" saying "Verifying system requirements" pops up. And then if there is an updated version in the server, clickonce updates the local installed version, and launches the application. Is there any way to customize this whole process. That doesn't mean that I want to do something with the installation/up-gradation part, I just want to change the GUI of this whole thing. Some thing like a screen which says "Starting the application...." along with an indefinite progress bar would be fine. This screen should come in place of all the clickonce pop-ups yet allowing clickonce to do the actual things in background. Kind-of splash screen is what I meant, but which overrides the GUI of clickonce screens... Any suggestions???

Sandeep
  • 5,581
  • 10
  • 42
  • 62

1 Answers1

0

There is a possibility to update the application progammatically, by using ApplicationDeployment class. But in this case you should implement update logic, which might be simple or sophisticated according the problem.

In case you are chacking and downloading updates programmatically, you can uncheck the update option in "Publish" window, i.e. the application will not be updated by ClickOnce and will do all the updating logic you write. In code you can add splash screen and update synchronously or add some "dynamics" and let the user know the progress of the update using the data provided by CheckForDetailedUpdate method.

Little sample:

    [STAThread]
    static void Main()
    {
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);

        bool isUpdated = tryUpdateApplication();

        if (isUpdated)
        {
            Application.Restart();
        }
        else
        {
            Application.Run(new MainForm());
        }
    }

    static bool tryUpdateApplication()
    {
        bool result = false;

        try
        {
            UpdateCheckInfo info = ApplicationDeployment.CurrentDeployment.CheckForDetailedUpdate();

            if (info.UpdateAvailable)
            {
                //Show what you want to show
                ApplicationDeployment.CurrentDeployment.Update();
                //Hide what you showed
                result = true;
            }
        }
        catch (Exception ex) //better to catch the specific exceptions
        {
            //some exception handling logic
        }

        return result;
    }
Revaz
  • 310
  • 1
  • 2
  • 11