示例#1
0
        private void WorkerOnRunWorkerCompleted(object sender, RunWorkerCompletedEventArgs runWorkerCompletedEventArgs)
        {
            if (runWorkerCompletedEventArgs.Error != null)
            {
                Application.Exit();
                Common.Start(_localRelease, true);
                return;
            }
            _remoteRelease = runWorkerCompletedEventArgs.Result as ReleaseList;

            if (_localRelease.Compare(_remoteRelease) == 0)
            {
                Application.Exit();
                Common.Start(_localRelease, false);
                return;
            }
            //Hide();

            if (CheckProcessing() != DialogResult.OK)
            {
                Application.Exit();
                return;
            }
            var form = new UpdateForm(_localRelease, _remoteRelease);

            form.ShowDialog();
        }
示例#2
0
        private void Init()
        {
            OptionalUpdate = _localRelease.Compare(_remoteRelease.MinVersion) >= 0;
            lblTitle.Text  = string.Format(
                lblTitle.Text,
                _localRelease.ReleaseVersion,
                _remoteRelease.ReleaseVersion,
                _remoteRelease.ReleaseDate);
            try
            {
                if (_updateProxy != null)
                {
                    boxDes.Text = _updateProxy.GetUpdateLogBetweenVersion(_localRelease.ReleaseVersion,
                                                                          _remoteRelease.ReleaseVersion);
                }
                else
                {
                    boxDes.Text = _remoteRelease.UpdateDescription;
                }
            }
            catch
            {
                boxDes.Text = _remoteRelease.UpdateDescription;
            }
            _diff          = _localRelease.GetDifferences(_remoteRelease, out _totalSize);
            _totalSizeDesc = DownloadUtil.FormatFileSizeDescription(_totalSize);
            if (_diff == null || _totalSize == 0)
            {
                btnUpgrade.Text = _finishText;
                return;
            }

            progressBar1.Maximum = 100;
            if (!btnUpgrade.Enabled)
            {
                DoUpgrade();
            }
        }
示例#3
0
        private bool ValidateInput()
        {
            if (!chkZip.Checked && gridFileList.Rows.Count == 0)
            {
                return(false);
            }

            gridFileList.EndEdit();

            _releaseList.ApplicationStart = GetSelectedFileName(ColExe.Name);
            if (string.IsNullOrEmpty(_releaseList.ApplicationStart))
            {
                Common.ShowError("choose a main .exe file");
                gridFileList.Focus();
                return(false);
            }
            _releaseList.Company = txtCompany.Text.Trim();
            if (string.IsNullOrEmpty(_releaseList.Company))
            {
                Common.ShowError("company name is required");
                txtCompany.Focus();
                return(false);
            }

            _releaseList.AppName = txtAppName.Text.Trim();
            if (string.IsNullOrEmpty(_releaseList.AppName))
            {
                Common.ShowError("app name is required");
                txtAppName.Focus();
                return(false);
            }
            _releaseList.ReleaseUrl = txtRelaseUrl.Text.Trim();
            if (string.IsNullOrEmpty(_releaseList.ReleaseUrl))
            {
                Common.ShowError("release web root is required");
                txtRelaseUrl.Focus();
                return(false);
            }
            _releaseList.ShortcutIcon = GetSelectedFileName(ColIco.Name);
            //if (string.IsNullOrEmpty(this.reList.ShortcutIcon))
            //{
            //    Common.ShowError("shortcut icon is required");
            //    this.txtIcon.Focus();
            //    return false;
            //}
            _releaseList.MinVersion = txtMinVer.Text.Trim();
            if (string.IsNullOrEmpty(_releaseList.MinVersion))
            {
                Common.ShowError("min version number is required");
                txtMinVer.Focus();
                return(false);
            }
            //_versionChanged = _releaseList.ReleaseVersion != txtReleaseVer.Text.Trim();
            _releaseList.ReleaseVersion = txtReleaseVer.Text.Trim();
            if (string.IsNullOrEmpty(_releaseList.ReleaseVersion))
            {
                Common.ShowError("release version number is required");
                txtReleaseVer.Focus();
                return(false);
            }
            if (_releaseList.Compare(_releaseList.MinVersion) < 0)
            {
                Common.ShowError("Minimum Version > Release Version ?");
                txtMinVer.Clear();
                txtMinVer.Focus();
                return(false);
            }
            _releaseList.UpdateDescription = txtUplog.Text;
            if (string.IsNullOrEmpty(_releaseList.UpdateDescription))
            {
                Common.ShowError("Update log is required");
                txtUplog.Focus();
                return(false);
            }
            return(true);
        }