示例#1
0
        private void UpdateManager_CheckForUpdateInformation(object sender, UpdateEventArgs e)
        {
            var update = new UpdaterInformation
            {
                CurrentVersion = new Version("1.0.0.0"),
                DownloadURL    = "http://rbsoft.org/downloads/AutoUpdaterTestWPF.zip",
                ChangelogURL   = "https://github.com/ravibpatel/AutoUpdater.NET/releases",
                UpdateMode     = EazyUpdateMode.Normal
            };

            e.UpdateInfo   = update;
            e.Options      = new EazyUpdaterOptions();
            e.AssemblyInfo = Assembly.GetExecutingAssembly();
        }
        public UpdaterManager(Button button, UpdaterInformation newUpdaterInformation)
        {
            instanceMutex      = new Mutex(true, @"Local\" + Assembly.GetExecutingAssembly().GetType().GUID);
            updateButton       = button;
            updaterInformation = newUpdaterInformation;
            /* Configure callback */
            ApplicationDeployment.CurrentDeployment.CheckForUpdateCompleted       += new CheckForUpdateCompletedEventHandler(ad_CheckForUpdateCompleted);
            ApplicationDeployment.CurrentDeployment.CheckForUpdateProgressChanged += new DeploymentProgressChangedEventHandler(ad_CheckForUpdateProgressChanged);
            ApplicationDeployment.CurrentDeployment.UpdateCompleted += new AsyncCompletedEventHandler(ad_UpdateCompleted);
            /* Indicate progress in the application's status bar. */
            ApplicationDeployment.CurrentDeployment.UpdateProgressChanged += new DeploymentProgressChangedEventHandler(ad_UpdateProgressChanged);

            /* When this class start ask for an update */
            ApplicationDeployment.CurrentDeployment.CheckForUpdateAsync();
        }