示例#1
0
        void mBgWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            if (!e.Cancelled)
            {
                AutoUpdateXml update = (AutoUpdateXml)e.Result;

                if (update != null && update.IsNewerThan(mAppInfo.ApplicationAssembly.GetName().Version))
                {
                    this.DownloadUpdate(update);
                }
            }
        }
示例#2
0
        void mBgWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            IAutoUpdatable app = (IAutoUpdatable)e.Argument;

            if (!AutoUpdateXml.ExistsOnServer(app.UpdateXmlLocation))
            {
                e.Cancel = true;
            }
            else
            {
                e.Result = AutoUpdateXml.Parse(app.UpdateXmlLocation, app.ApplicationID);
            }
        }
示例#3
0
        private Boolean VerificaVersao()
        {
            if (AutoUpdateXml.ExistsOnServer(mUri))
            {
                //Carrega o XML do servidor
                mAutoUpdate = AutoUpdateXml.Parse(mUri, mAppId);

                //Se retornar true, significa que o cliente não tem a última versão.
                if (mAutoUpdate.IsNewerThan(Version.Parse(mAppVersion)))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            return(false);
        }
示例#4
0
        private void DownloadUpdate(AutoUpdateXml Update)
        {
            FrmDownloading frm    = new FrmDownloading(Update._Uri, Update._Md5);
            DialogResult   result = frm.ShowDialog(this.mAppInfo.Context);

            if (result == DialogResult.OK)
            {
                string currentPath = this.mAppInfo.ApplicationAssembly.Location;
                string newPath     = Path.GetDirectoryName(currentPath) + "\\" + Update._FileName;

                UpdateCurrentApplication(frm._TmpFilePath, currentPath, newPath, Update._LaunchArgs);

                Application.Exit();
            }
            else if (result == DialogResult.Abort)
            {
                MessageBox.Show("Atualização cancelada. Essa versão do sistema não será modificada", "Atualização cancelada", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                MessageBox.Show("Houve um problema durante o download da atualização", "Erro na atualização de versão", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }