Beispiel #1
0
        void checker_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            if (!e.Cancelled)
            {
                CheckForUpdateCompleteEventArgs args = null;
                bool userInitiated = (bool)e.UserState;

                if (e.Error == null)
                {
                    this.updatedManifest = Manifest.Parse(e.Result);
                    if (this.updatedManifest != null)
                    {
                        args = new CheckForUpdateCompleteEventArgs(this.updatedManifest, this.currentVersion, userInitiated, null);
                        this.updateAvailable = args.UpdateAvailable;
                    }
                }

                // this could be because e.Error != null or because the Manifest.Parse() failed
                if (args == null)
                {
                    UpdateErrorEventArgs errorArgs = new UpdateErrorEventArgs(e.Error, "Growl was unable to determine if a newer version is available. Please try again later.");
                    args = new CheckForUpdateCompleteEventArgs(null, this.currentVersion, userInitiated, errorArgs);
                }

                this.OnCheckForUpdateComplete(args);
            }
        }
Beispiel #2
0
 protected void OnCheckForUpdateComplete(CheckForUpdateCompleteEventArgs args)
 {
     if (this.CheckForUpdateComplete != null)
     {
         this.CheckForUpdateComplete(this, args);
     }
 }
Beispiel #3
0
 protected void OnCheckForUpdateComplete(CheckForUpdateCompleteEventArgs args)
 {
     if (this.CheckForUpdateComplete != null)
     {
         this.CheckForUpdateComplete(this, args);
     }
 }
Beispiel #4
0
        void checker_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            if (!e.Cancelled)
            {
                CheckForUpdateCompleteEventArgs args = null;
                bool userInitiated = (bool)e.UserState;

                if (e.Error == null)
                {
                    this.updatedManifest = Manifest.Parse(e.Result);
                    if (this.updatedManifest != null)
                    {
                        args = new CheckForUpdateCompleteEventArgs(this.updatedManifest, this.currentVersion, userInitiated, null);
                        this.updateAvailable = args.UpdateAvailable;
                    }
                }

                // this could be because e.Error != null or because the Manifest.Parse() failed
                if(args == null)
                {
                    UpdateErrorEventArgs errorArgs = new UpdateErrorEventArgs(e.Error, "Growl was unable to determine if a newer version is available. Please try again later.");
                    args = new CheckForUpdateCompleteEventArgs(null, this.currentVersion, userInitiated, errorArgs);
                }

                this.OnCheckForUpdateComplete(args);
            }
        }
Beispiel #5
0
        void updater_CheckForUpdateComplete(Updater sender, CheckForUpdateCompleteEventArgs args)
        {
            // make sure any exisiting form is closed first (we dont want to re-use it directly because it might get
            // disposed out from under us).
            if (this.updateForm != null)
            {
                try
                {
                    this.updateForm.Close();
                    this.updateForm.Dispose();
                    this.updateForm = null;
                }
                finally
                {
                    // this is just in case the form was closed but not disposed of properly
                }
            }

            // if there is an update available or if the user asked specifically, show the update form
            if (args.UpdateAvailable || args.UserInitiated)
            {
                this.updateForm = new UpdateForm(this.updater);
                this.updateForm.LaunchUpdater(args.Manifest, args.UpdateAvailable, args.ErrorArgs);
            }
            this.autoUpdateTimer.Start();
        }