示例#1
0
        private void BgWorger_DoWork(object sender, DoWorkEventArgs e)
        {
            Updateable application = (Updateable)e.Argument;

            if (!UpdateXML.ExsistsOnServer(application.UpdateXmlLocation))
            {
                e.Cancel = true;
            }
            else
            {
                e.Result = UpdateXML.Parse(application.UpdateXmlLocation, application.ApplicationID);
            }
        }
示例#2
0
        public UpdateInfoForm(Updateable applicationInfo, UpdateXML updateInfo)
        {
            InitializeComponent();

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

            this.Text = applicationInfo.ApplicationName + " - Update Info";
            this.lblVersionOld.Text   = "Current Version: " + applicationInfo.ApplicationAssembly.GetName().Version.ToString();
            this.lblVersionNew.Text   = "Current Version: " + updateInfo.Version.ToString();
            this.textDescription.Text = updateInfo.Description;
        }
示例#3
0
        private void BgWorger_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            if (!e.Cancelled)
            {
                UpdateXML update = (UpdateXML)e.Result;

                if (update != null && update.IsNewerThan(this.applicationInfo.ApplicationAssembly.GetName().Version))
                {
                    if (new UpdateAcceptForm(this.applicationInfo, update).ShowDialog(this.applicationInfo.Context) == DialogResult.Yes)
                    {
                        this.DownloadUpdate(update);
                    }
                }
            }
        }
示例#4
0
        internal UpdateAcceptForm(Updateable applicationInfo, UpdateXML updateInfo)
        {
            InitializeComponent();

            this.applicationInfo = applicationInfo;
            this.updateInfo      = updateInfo;

            this.Text = this.applicationInfo.ApplicationName + " - Update available";

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

            this.lblNewVersion.Text = string.Format("New Version: {0}", this.updateInfo.Version.ToString());
        }
示例#5
0
        private void DownloadUpdate(UpdateXML update)
        {
            UpdateDownloadForm form   = new UpdateDownloadForm(update.Uri, update.Md5, this.applicationInfo.ApplicationIcon);
            DialogResult       result = form.ShowDialog(this.applicationInfo.Context);

            if (result == DialogResult.OK)
            {
                string currentPath = this.applicationInfo.ApplicationAssembly.Location;
                string newPath     = Path.GetDirectoryName(currentPath) + "\\" + update.FileName;

                UpdateApplication(form.TempFilePath, currentPath, newPath, update.LaunchArgs);

                Application.Exit();
            }
            else if (result == DialogResult.Abort)
            {
                MessageBox.Show("The update download was cancelled.\nThis Programm has not been modified.", "Update Download Cancelled", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("There was a problem downloading the update.\nPlease try again later.", "Update Download Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }