public CheckForUpdateCompleteEventArgs(Manifest manifest, string currentVersion, bool userInitiated, UpdateErrorEventArgs errorArgs)
 {
     this.manifest = manifest;
     this.currentVersion = currentVersion;
     this.userInitiated = userInitiated;
     this.errorArgs = errorArgs;
 }
Exemplo n.º 2
0
 protected void OnUpdateError(UpdateErrorEventArgs e)
 {
     if (this.UpdateError != null)
     {
         this.UpdateError(this, e);
     }
 }
Exemplo n.º 3
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);
            }
        }
Exemplo n.º 4
0
 public void LaunchUpdater(Manifest manifest, bool updateAvailable, UpdateErrorEventArgs args)
 {
     if (this.updater != null)
     {
         if (args != null)
         {
             this.updater_UpdateError(this.updater, args);
         }
         else if (updateAvailable)
         {
             this.NoButton.Visible = true;
             this.YesButton.Visible = true;
             this.progressBar1.Visible = false;
             this.OKButton.Visible = false;
             this.InfoLabel.Text = String.Format(Properties.Resources.Updater_UpdateAvailable, manifest.Version, this.updater.CurrentVersion);
         }
         else
         {
             this.NoButton.Visible = false;
             this.YesButton.Visible = false;
             this.progressBar1.Visible = false;
             this.OKButton.Visible = true;
             this.InfoLabel.Text = String.Format(Properties.Resources.Updater_GrowlIsUpToDate, this.updater.CurrentVersion, this.updater.CurrentVersion);
         }
         this.Show();
         this.Activate();
     }
 }
Exemplo n.º 5
0
 public void LaunchUpdater(Manifest manifest, bool updateAvailable, UpdateErrorEventArgs args)
 {
     if (this.updater != null)
     {
         if (args != null)
         {
             this.updater_UpdateError(this.updater, args);
         }
         else if (updateAvailable)
         {
             this.NoButton.Visible     = true;
             this.YesButton.Visible    = true;
             this.progressBar1.Visible = false;
             this.OKButton.Visible     = false;
             this.InfoLabel.Text       = String.Format(Properties.Resources.Updater_UpdateAvailable, manifest.Version, this.updater.CurrentVersion);
         }
         else
         {
             this.NoButton.Visible     = false;
             this.YesButton.Visible    = false;
             this.progressBar1.Visible = false;
             this.OKButton.Visible     = true;
             this.InfoLabel.Text       = String.Format(Properties.Resources.Updater_GrowlIsUpToDate, this.updater.CurrentVersion, this.updater.CurrentVersion);
         }
         this.Show();
         this.Activate();
     }
 }
Exemplo n.º 6
0
 public CheckForUpdateCompleteEventArgs(Manifest manifest, string currentVersion, bool userInitiated, UpdateErrorEventArgs errorArgs)
 {
     this.manifest       = manifest;
     this.currentVersion = currentVersion;
     this.userInitiated  = userInitiated;
     this.errorArgs      = errorArgs;
 }
Exemplo n.º 7
0
        void updater_UpdateError(Updater sender, UpdateErrorEventArgs args)
        {
            this.NoButton.Visible     = false;
            this.YesButton.Visible    = false;
            this.progressBar1.Visible = false;
            this.OKButton.Visible     = true;

            this.InfoLabel.Text = args.UserMessage;
        }
Exemplo n.º 8
0
        void downloader_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
        {
            if (e.Error != null)
            {
                UpdateErrorEventArgs args = new UpdateErrorEventArgs(e.Error, "An error occurred while downloading the necessary update files. Please try again later.");
                this.OnUpdateError(args);
            }
            else if (e.Cancelled)
            {
                UpdateException      ex   = new UpdateException("Update was cancelled");
                UpdateErrorEventArgs args = new UpdateErrorEventArgs(ex, "Update cancelled.");
                this.OnUpdateError(args);
            }
            else
            {
                this.OnDownloadComplete(EventArgs.Empty);

                // unzip files
                InstallInfo info = (InstallInfo)e.UserState;
                Installation.Unzipper.UnZipFiles(info.ZipFile, info.Folder, false);

                // start the update installer
                string setupFile = info.SetupFile;
                System.Diagnostics.ProcessStartInfo si = new System.Diagnostics.ProcessStartInfo(setupFile);
                System.Diagnostics.Process.Start(si);

                // exit this application
                ApplicationMain.Program.ExitApp();
            }

            Growl.CoreLibrary.WebClientEx downloader = (Growl.CoreLibrary.WebClientEx)sender;
            downloader.DownloadProgressChanged -= new DownloadProgressChangedEventHandler(downloader_DownloadProgressChanged);
            downloader.DownloadFileCompleted   -= new AsyncCompletedEventHandler(downloader_DownloadFileCompleted);
            downloader.Dispose();
            downloader = null;
        }
Exemplo n.º 9
0
        void downloader_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
        {
            if (e.Error != null)
            {
                UpdateErrorEventArgs args = new UpdateErrorEventArgs(e.Error, "An error occurred while downloading the necessary update files. Please try again later.");
                this.OnUpdateError(args);
            }
            else if (e.Cancelled)
            {
                UpdateException ex = new UpdateException("Update was cancelled");
                UpdateErrorEventArgs args = new UpdateErrorEventArgs(ex, "Update cancelled.");
                this.OnUpdateError(args);
            }
            else
            {
                this.OnDownloadComplete(EventArgs.Empty);

                // unzip files
                InstallInfo info = (InstallInfo) e.UserState;
                Installation.Unzipper.UnZipFiles(info.ZipFile, info.Folder, false);

                // start the update installer
                string setupFile = info.SetupFile;
                System.Diagnostics.ProcessStartInfo si = new System.Diagnostics.ProcessStartInfo(setupFile);
                System.Diagnostics.Process.Start(si);

                // exit this application
                ApplicationMain.Program.ExitApp();
            }

            Growl.CoreLibrary.WebClientEx downloader = (Growl.CoreLibrary.WebClientEx)sender;
            downloader.DownloadProgressChanged -= new DownloadProgressChangedEventHandler(downloader_DownloadProgressChanged);
            downloader.DownloadFileCompleted -= new AsyncCompletedEventHandler(downloader_DownloadFileCompleted);
            downloader.Dispose();
            downloader = null;
        }
Exemplo n.º 10
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);
            }
        }
Exemplo n.º 11
0
 protected void OnUpdateError(UpdateErrorEventArgs e)
 {
     if (this.UpdateError != null)
     {
         this.UpdateError(this, e);
     }
 }
Exemplo n.º 12
0
        void updater_UpdateError(Updater sender, UpdateErrorEventArgs args)
        {
            this.NoButton.Visible = false;
            this.YesButton.Visible = false;
            this.progressBar1.Visible = false;
            this.OKButton.Visible = true;

            this.InfoLabel.Text = args.UserMessage;
        }