private void DownloadUpdate(ApplicationUpdaterXmlHandler applicationUpdaterXml)
        {
            ApplicationUpdaterDownloadForm downloadForm = new ApplicationUpdaterDownloadForm(applicationUpdaterXml.Uri, this.applicationUpdaterInfo.ApplicationIcon, this.applicationUpdaterInfo.ApplicationAssembly.Location);
            DialogResult diaResults = downloadForm.ShowDialog(this.applicationUpdaterInfo.ApplicationForm);

            switch (diaResults)
            {
            case DialogResult.OK:
                string currentPath = this.applicationUpdaterInfo.ApplicationAssembly.Location;
                string newPath     = Path.GetDirectoryName(currentPath) + "\\" + applicationUpdaterXml.Filename;

                UpdateApplication(downloadForm.TempFilePath, currentPath, newPath, applicationUpdaterXml.LaunchArgs);

                Application.Exit();

                break;

            case DialogResult.Abort:
                MessageBox.Show("The update download was cancelled.\nThis program has not been modified.", "Update Download Cancalled", MessageBoxButtons.OK, MessageBoxIcon.Information);
                break;

            default:
                MessageBox.Show("There was a problem downloading the update. \n Please try again later", "Update Download Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                break;
            }
        }
        private void bgWorker_DoWork(object s, DoWorkEventArgs e)
        {
            IApplicationUpdate application = (IApplicationUpdate)e.Argument;

            if (!ApplicationUpdaterXmlHandler.UriExists(application.ApplicationUpdaterXmlLocation))
            {
                e.Cancel = true;
            }
            else
            {
                e.Result = ApplicationUpdaterXmlHandler.ParseXmlNode(application.ApplicationUpdaterXmlLocation, application.ApplicationID);
            }
        }
        private void bgWorker_RunWorkerCompleted(object s, RunWorkerCompletedEventArgs e)
        {
            if (!e.Cancelled)
            {
                ApplicationUpdaterXmlHandler xmlUpdater = (ApplicationUpdaterXmlHandler)e.Result;

                if (xmlUpdater != null && xmlUpdater.AppIsNewer(this.applicationUpdaterInfo.ApplicationAssembly.GetName().Version))
                {
                    if (new ApplicationUpdaterAcceptForm(this.applicationUpdaterInfo, xmlUpdater).ShowDialog(this.applicationUpdaterInfo.ApplicationForm) == DialogResult.Yes)
                    {
                        this.DownloadUpdate(xmlUpdater);
                    }
                }
            }
        }
 private void bgWorkerCheckUpdate_RunWorkerCompleted(object s, RunWorkerCompletedEventArgs e)
 {
     if (!e.Cancelled)
     {
         ApplicationUpdaterXmlHandler checker = (ApplicationUpdaterXmlHandler)e.Result;
         if (checker != null && checker.AppIsNewer(this.applicationUpdaterInfo.ApplicationAssembly.GetName().Version))
         {
             newUpdate = true;
         }
         else
         {
             newUpdate = false;
         }
     }
 }
        internal ApplicationUpdaterAcceptForm(IApplicationUpdate applicationUpdaterInfo, ApplicationUpdaterXmlHandler applicationUpdaterXml)
        {
            InitializeComponent();

            this.applicationUpdaterInfo = applicationUpdaterInfo;
            this.applicationUpdaterXml  = applicationUpdaterXml;

            this.Text = this.applicationUpdaterInfo.ApplicationName + " - Update Available";

            if (this.applicationUpdaterInfo.ApplicationIcon != null)
            {
                this.Icon = this.applicationUpdaterInfo.ApplicationIcon;
            }

            this.lblNewVersion.Text = string.Format("New Version: {0}", this.applicationUpdaterXml.Version.ToString());
        }
        internal ApplicationUpdaterDetailsForm(IApplicationUpdate applicationUpdaterInfo, ApplicationUpdaterXmlHandler applicationUpdaterXml)
        {
            InitializeComponent();

            if (applicationUpdaterInfo.ApplicationIcon != null)
            {
                this.Icon = applicationUpdaterInfo.ApplicationIcon;
            }

            this.Text             = applicationUpdaterInfo.ApplicationName + " - Update Info";
            this.lblVersions.Text = string.Format("Current Version: {0}\nUpdate Version: {1}", applicationUpdaterInfo.ApplicationAssembly.GetName().Version.ToString(),
                                                  applicationUpdaterXml.Version.ToString());
            this.txtDescription.Text = applicationUpdaterXml.Description;
        }