示例#1
0
        /// <summary>
        /// After the background worker is done, prompt to update if there is one
        /// </summary>
        private void bgWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            // If there is a file on the server
            if (!e.Cancelled)
            {
                SharpUpdateXml update = (SharpUpdateXml)e.Result;

                // Check if the update is not null and is a newer version than the current application
                if (update != null && update.IsNewerThan(this.applicationInfo.ApplicationAssembly.GetName().Version))
                {
                    // Ask to accept the update
                    if (new SharpUpdateAcceptForm(this.applicationInfo, update).ShowDialog(this.applicationInfo.Context) == DialogResult.Yes)
                    {
                        this.DownloadUpdate(update);                         // Do the update
                    }
                }
                else
                {
                    MessageBox.Show("You have the latest version already!");
                }
            }
            else
            {
                MessageBox.Show("No update information found!");
            }
        }
        /// <summary>
        /// After the background worker is done, prompt to update if there is one
        /// </summary>
        private void bgWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            // If there is a file on the server
            if (!e.Cancelled)
            {
                SharpUpdateXml update = (SharpUpdateXml)e.Result;

                // Check if the update is not null and is a newer version than the current application
                if (update != null && update.IsNewerThan(this.applicationInfo.ApplicationAssembly.GetName().Version))
                {
                    // Ask to accept the update
                    if (new SharpUpdateAcceptForm(this.applicationInfo, update).ShowDialog(this.applicationInfo.Context) == DialogResult.Yes)
                    {
                        this.DownloadUpdate(update);                         // Do the update
                    }
                }
                else
                {
                    MessageBox.Show("У Вас установлена последняя версия программы");
                }
            }
            else
            {
                MessageBox.Show("Не найдена информация об обновлении");
            }
        }
示例#3
0
        /// <summary>
        /// After the background worker is done, prompt to update if there is one
        /// </summary>
        private void bgWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            // If there is a file on the server
            if (!e.Cancelled)
            {
                SharpUpdateXml update = (SharpUpdateXml)e.Result;

                // Check if the update is not null and is a newer version than the current application
                if (update != null)
                {
                    //Check for missing files
                    if (!update.HasAllFiles(AssemblyDirectory()))
                    {
                        this.DownloadUpdate(update);
                    }
                    else if (update.IsNewerThan(this.applicationInfo.ApplicationAssembly.GetName().Version))
                    {
                        // Ask to accept the update
                        if (new SharpUpdateAcceptForm(this.applicationInfo, update).ShowDialog(this.applicationInfo.Context) == DialogResult.Yes)
                        {
                            if (doUpdate)
                            {
                                this.DownloadUpdate(update); // Do the update
                            }
                            else
                            {//This is not the only instance
                                MessageBox.Show(SharpUpdate.LanguageFile._default.SharpUpdater_DoubleInstanceWarning,
                                                SharpUpdate.LanguageFile._default.SharpUpdater_DoubleInstanceWarningTitle,
                                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
                            }
                        }
                    }
                }
            }
        }
        private void bgWorker_RunWorkerCompleted(Object sender, RunWorkerCompletedEventArgs e)
        {
            if (!e.Cancelled)
            {
                SharpUpdateXml update = (SharpUpdateXml)e.Result;

                if (update != null && update.IsNewerThan(this.applicationInfo.ApplicationAssembly.GetName().Version))
                {
                    if (new SharpUpdateAcceptForm(this.applicationInfo, update).ShowDialog(this.applicationInfo.context) == DialogResult.Yes)
                    {
                        this.DownloadUpdate(update);
                    }
                }
            }
        }
示例#5
0
        private void bgWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            if (!e.Cancelled)
            {
                SharpUpdateXml update = (SharpUpdateXml)e.Result;

                System.Diagnostics.FileVersionInfo ver =
                    System.Diagnostics.FileVersionInfo.GetVersionInfo(
                        this.applicationInfo.ApplicationAssembly.Location);

                string[] tmpv = ver.FileVersion.Split('.');
                Version  v    = new Version(Int32.Parse(tmpv[0]),
                                            Int32.Parse(tmpv[1]),
                                            Int32.Parse(tmpv[2]),
                                            Int32.Parse(tmpv[3]));

                if (update != null && update.IsNewerThan(this.applicationInfo.ApplicationAssembly.GetName().Version))
                //if (update != null && update.IsNewerThan(v))
                {
                    fc.ErrorLog("Version=" + this.applicationInfo.ApplicationAssembly.GetName().Version);
                    //fc.ErrorLog("Version=" + v);
                    fc.ErrorLog("this.applicationInfo.Context=" + this.applicationInfo.Context);
                    Form f = this.applicationInfo.Context;
                    fc.ErrorLog("f=" + f.ToString());

                    if (FBool)
                    {
                        return;
                    }
                    else if (new SharpUpdateAcceptForm(this.applicationInfo, update).ShowDialog(f) == DialogResult.Yes)
                    {
                        this.DownloadUpdate(update);
                    }
                }
                else
                {
                    if (!FBool)
                    {
                        fc.Msg("版本:" + this.applicationInfo.ApplicationAssembly.GetName().Version + " 已是最新版!", "提示");
                    }
                    //MessageBox.Show("版本:" + v + " 已是最新版!");
                }
            }
        }