Exemple #1
0
        static void HandleCheckForUpdateCompleted(object sender, CheckForUpdateCompletedEventArgs e)
        {
            if (e.UpdateAvailable)
            {
                StringBuilder sb = new StringBuilder();
                sb.AppendLine("An update is available. It will be downloaded and installed the next time you run the application.");
                sb.AppendLine();
                sb.AppendLine("Current version: " + GetVersion());
                sb.AppendLine("New version: " + ToVersionString(e.AvailableVersion));
                sb.AppendLine("Update size: " + e.UpdateSizeBytes + " bytes");
                sb.AppendLine();
                sb.AppendLine("Do you want to restart the application now?");

                // Get a form so we can invoke on the thread
                Form form = Application.OpenForms.Count > 0 ? Application.OpenForms[0] : null;
                if (form != null)
                {
                    form.Invoke((Action)(() =>
                    {
                        if (MessageBox.Show(form, sb.ToString(), "Update available!", MessageBoxButtons.YesNo) == DialogResult.Yes)
                        {
                            Application.Restart();
                        }
                    }));
                }
            }
        }
Exemple #2
0
        void checkUpdate_CheckForUpdateCompleted(object sender, CheckForUpdateCompletedEventArgs e)
        {
            ////ปิดฟอร์ม frmProgress
            frmpro.Close();

            if (e.Error != null)
            {
                MessageBox.Show("ERROR: Could not retrieve new version of the application. Reason: \n" +
                                e.Error.Message + "\nPlease report this error to the system administrator.");
                return;
            }
            else if (e.Cancelled == true)
            {
                MessageBox.Show("The update was cancelled.");
            }

            //ถ้าเป็นการ Update
            if (e.UpdateAvailable)
            {
                //ประกาศตัวแปร verion โดยดึงค่าเวอร์ชั่นใหม่ บนเซอร์เวอร์
                string verion = e.AvailableVersion.ToString();

                //โดย MessageBox แจ้งให้ผู้ใช้งานทราบ ว่ามีเวอร์ชั่นใหม่
                //ขณะเดียวกันก็แสดงข้อมูลในตัวแปร smsUpdate ซึ่งสมมุติว่า เป็นการดึงรายการปรับปรุง ของเวอร์ชั่นใหม่ บนเซอร์ฟเวอร์ เพื่อให้ผู้ใช้งานทราบ
                //MessageBox.Show("โปรแกรมมีเวอร์ชั่นใหม่ [" + verion + "]"
                //       + Environment.NewLine + smsUpdate + Environment.NewLine +
                //       "กรุณา Update เพื่อให้คุณทันสมัย...", "ผลการตรวจสอบ", MessageBoxButtons.OK, MessageBoxIcon.Information);

                //เรียกเมธอด BeginUpdate เพื่อเริ่ม Update เวอร์ชั่นใหม่
                BeginUpdate();
            }
        }
        private void Ad_CheckForUpdateCompleted(object sender, CheckForUpdateCompletedEventArgs e)
        {
            ApplicationDeployment ad = ApplicationDeployment.CurrentDeployment;

            if (e.Error != null)
            {
                logger.Error(e.Error, "检查版本更新出错");
                return;
            }
            if (e.Cancelled)
            {
                return;
            }
            if (e.UpdateAvailable)
            {
                if (e.IsUpdateRequired)
                {
                    BeginUpdate();
                }
                else
                {
                    UpdateAction = () => BeginUpdate();
                    UpdateBar.Dispatcher.Invoke(() =>
                    {
                        UpdateBar.MainText   = string.Format("发现新版本: {0} 大小: {1}KiB", e.AvailableVersion, e.UpdateSizeBytes / 1024);
                        UpdateBar.ButtonText = "下载更新";
                        UpdateBar.Display    = true;
                    });
                }
            }
        }
Exemple #4
0
        void DeploymentCheckForUpdateCompleted(object sender, CheckForUpdateCompletedEventArgs e)
        {
            if (e.Error != null)
            {
                _Logger.WarnException("Check for updates failed!", e.Error);
                return;
            }

            if (!e.UpdateAvailable)
            {
                return;
            }

            NewVersion = e.AvailableVersion;
            IsRequired = e.IsUpdateRequired;

            _Logger.Info(string.Format("A new update is available! Old version: {0}, new version: {1}, mandatory: {2}",
                                       _Deployment.CurrentVersion, NewVersion, IsRequired));

            try {
                _Deployment.UpdateAsync();
            }
            catch (Exception exc) {
                _Logger.WarnException("Update failed!", exc);
            }
        }
        private void ad_CheckForUpdateCompleted(object sender, CheckForUpdateCompletedEventArgs e)
        {
            if (e.Error != null)
            {
                MessageBox.Show("ERROR: Could not retrieve new version of the application. Reason: \n" + e.Error.Message + "\nPlease report this error to the system administrator.");
                return;
            }
            else if (e.Cancelled == true)
            {
                MessageBox.Show("The update was cancelled.");
            }

            if (e.UpdateAvailable)
            {
                Dispatcher.CurrentDispatcher.Invoke(() =>
                {
                    updaterInformation.PopupText.Text = "Nouvelle version disponible !";
                    updateButton.Visibility           = Visibility.Visible;
                });
                if (e.IsUpdateRequired)
                {
                    BeginUpdate();
                }
            }
        }
Exemple #6
0
 void CurrentDeployment_CheckForUpdateCompleted(object sender, CheckForUpdateCompletedEventArgs e)
 {
     try
     {
         ControlHelper.EnsureThreadLocalized();
         updateInfo = e;
         if (e.Error != null)
         {
             UpdateFailed = true;
             ExceptionHandler.Default.Process(e.Error, ApplicationStrings.ErrorDuringCheckingUpdates, ErrorWindow.EMailReport);
             UpdateFinished = true;
             return;
         }
         if (e.UpdateAvailable)
         {
             Log.WriteVerbose("Update available");
             ApplicationDeployment.CurrentDeployment.UpdateAsync();
         }
         else
         {
             Log.WriteVerbose("Update is not available");
             UpdateFinished = true;
         }
     }
     catch (Exception ex)
     {
         ExceptionHandler.Default.Process(ex);
     }
 }
Exemple #7
0
        private void OnCheckForUpdateCompleted(object sender, CheckForUpdateCompletedEventArgs e)
        {
            if (e.Error != null)
            {
                MessageBox.Show("ERROR: Could not retrieve new version of the application. Reason: \n" + e.Error.Message + "\nPlease report this error to the system administrator.");
                return;
            }
            if (e.Cancelled)
            {
                MessageBox.Show("The update was cancelled.");
            }

            // Ask the user if they would like to update the application now.
            if (e.UpdateAvailable)
            {
                if (!e.IsUpdateRequired)
                {
                    long         updateSize = e.UpdateSizeBytes;
                    DialogResult dr         = MessageBox.Show(string.Format("Yeni Bir güncelleme mevcut ({0}K) .", updateSize / 1024), "Yeni güncelleme", MessageBoxButtons.OK);
                    BeginUpdate();
                }
                else
                {
                    MessageBox.Show("A mandatory update is available for your application. We will install the update now, after which we will save all of your in-progress data and restart your application.");
                    BeginUpdate();
                }
            }
            //else
            //{
            //    ShowMainForm();
            //}
        }
Exemple #8
0
        void ad_CheckForUpdateCompleted(object sender, CheckForUpdateCompletedEventArgs e)
        {
            if (e.Error != null)
            {
                MessageBox.Show("ERROR: Could not retrieve new version of the application. Reason: \n" + e.Error.Message + "\nPlease report this error to the system administrator.");
                return;
            }
            else if (e.Cancelled == true)
            {
                MessageBox.Show("The update was cancelled.");
            }

            // Ask the user if they would like to update the application now.
            if (e.UpdateAvailable)
            {
                sizeOfUpdate = e.UpdateSizeBytes;

                if (!e.IsUpdateRequired)
                {
                    DialogResult dr = MessageBox.Show("An update is available. Would you like to update the application now?\n\nEstimated Download Time: ", "Update Available", MessageBoxButtons.OKCancel);
                    if (DialogResult.OK == dr)
                    {
                        BeginUpdate();
                    }
                }
                else
                {
                    MessageBox.Show("A mandatory update is available for your application. We will install the update now, after which we will save all of your in-progress data and restart your application.");
                    BeginUpdate();
                }
            }
        }
Exemple #9
0
        static void ad_CheckForUpdateCompleted(object sender, CheckForUpdateCompletedEventArgs e)
        {
            if (e.Error != null)
            {
                MessageBox.Show("错误:未能更新" + appName + "到最新版本,原因: \n" + e.Error.Message + "\n重试操作或联系系统管理员.");
                return;
            }
            else if (e.Cancelled == true)
            {
                MessageBox.Show("The update was cancelled.");
            }

            // Ask the user if they would like to update the application now.
            if (e.UpdateAvailable)
            {
                sizeOfUpdate = e.UpdateSizeBytes;

                if (!e.IsUpdateRequired)
                {
                    DialogResult dr = MessageBox.Show("检测到" + appName + "有最新的版本更新(版本号:" + e.AvailableVersion + "),是否现在更新?\n\n升级预计需要: " + sizeOfUpdate / 1024 + "KB", "有可用的新版本", MessageBoxButtons.OKCancel);
                    if (DialogResult.OK == dr)
                    {
                        BeginUpdate();
                    }
                }
                else
                {
                    MessageBox.Show("您的" + appName + "需要更新。我们将立即安装更新,然后保存所有正在进行的数据,并重新启动" + appName + "。");
                    BeginUpdate();
                }
            }
        }
Exemple #10
0
 private void currentDeploy_CheckForUpdateCompleted(object sender, CheckForUpdateCompletedEventArgs e)
 {
     if (e.UpdateAvailable)
     {
         ApplicationDeployment current = ApplicationDeployment.CurrentDeployment;
         current.UpdateAsync();
     }
 }
Exemple #11
0
 private void ad_CheckForUpdateCompleted(object sender, CheckForUpdateCompletedEventArgs e)
 {
     try
     {
         listBox1.Items.Add(string.Format("AvailableVersion {0}", e.AvailableVersion.ToString()));
     }
     catch { }
 }
Exemple #12
0
 static void ad_CheckForUpdateCompleted(object sender, CheckForUpdateCompletedEventArgs e)
 {
     if (e.UpdateAvailable)
     {
         Application.Instance.AsyncInvoke(() => {
             var ad = ApplicationDeployment.CurrentDeployment;
             MessageBox.Show(Application.Instance.MainForm, string.Format("An update to version {0} is available (you have {1}). Restart the app to install!", e.AvailableVersion, ad.CurrentVersion));
         });
     }
 }
Exemple #13
0
        void ad_CheckForUpdateCompleted(object sender, CheckForUpdateCompletedEventArgs e)
        {
            ApplicationDeployment ad = ApplicationDeployment.CurrentDeployment;

            ad.CheckForUpdateCompleted -= new CheckForUpdateCompletedEventHandler(ad_CheckForUpdateCompleted);
            if (e.Error != null)
            {
                UpdateCompleted();
                return;
            }
            else if (e.Cancelled == true)
            {
                ShowMessage("The update was cancelled.");
                UpdateCompleted();
                return;
            }

            // Ask the user if they would like to update the application now.
            if (e.UpdateAvailable)
            {
                _sizeOfUpdate = e.UpdateSizeBytes / 1024;

                if (!e.IsUpdateRequired)
                {
                    DialogResult dr = MessageBox.Show("A new version of Witty Twitter is available!\nWould you like to update to the new version?\n\nDownload Size: " + _sizeOfUpdate + "K", "Update Available", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (DialogResult.Yes == dr)
                    {
                        BeginUpdate();
                    }
                    else
                    {
                        // user may not update the application
                        // for whatever reason
                        UpdateCompleted();
                    }
                }
                else
                {
                    ShowMessage("A mandatory update is available for your Witty Twitter.\n\nAfter the update is completed the application will restart.");
                    BeginUpdate();
                }
            }

            if (_showUpdateMessage && e.UpdateAvailable == false)
            {
                ShowMessage("No update found.");
                _showUpdateMessage = false; // don't show it again unless user clicks on the check update.
            }
            else if (e.UpdateAvailable == false)
            {
                _downloadStatusLabel.Text = "No update found.  You have the latest version.";
            }

            UpdateCompleted();
        }
Exemple #14
0
 /// <summary>
 /// Handles the CheckForUpdateCompleted event.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">A CheckForUpdateCompletedEventArgs that contains the event data.</param>
 private void CheckForUpdateCompleted(object sender, CheckForUpdateCompletedEventArgs e)
 {
     if (ApplicationDeployment.IsNetworkDeployed)
     {
         if (e.UpdateAvailable)
         {
             uxUpdate.Text    = "Update available.";
             uxUpdate.Visible = true;
         }
     }
 }
Exemple #15
0
        void ad_CheckForUpdateCompleted(object sender, CheckForUpdateCompletedEventArgs e)
        {
            if (e.Error != null)
            {
                LogMessage("AutoUpdate: ERROR: Could not retrieve new version of the application. Reason: \n" + e.Error.Message + "\nPlease report this error to the system administrator.");
                return;
            }
            else if (e.Cancelled == true)
            {
                LogMessage("AutoUpdate: The update was cancelled.");
                return;
            }

            try
            {
                LogMessage("AutoUpdate: Latest available version: " + e.AvailableVersion.ToString());
            }
            catch
            { // This will throw "Update not available" if the current installed deployment version is up-to-date
                LogMessage("AutoUpdate: Latest available version is installed");
            }

            // Ask the user if they would like to update the application now.
            if (e.UpdateAvailable)
            {
                LogMessage("AutoUpdate: An update is available (version " + e.AvailableVersion.ToString()
                           + ", " + e.UpdateSizeBytes.ToString() + " bytes).");

                //if (!e.IsUpdateRequired)
                //{
                //    DialogResult dr = MessageBox.Show(
                //        "An update is available. Would you like to update the application now?\n\n"
                //        + "The update will be installed in the background, and will be active \n"
                //        + "the next time you launch the application from the Start menu.",
                //        "Update Available", MessageBoxButtons.OKCancel);
                //    if (DialogResult.OK == dr)
                //    {
                //        BeginUpdate();
                //    }
                //}
                //else
                //{
                //    MessageBox.Show("A mandatory update is available for your application. The update will be installed in the background, \n"
                //        + "and will be active the next time you launch the application.", "Mandatory Update Available", MessageBoxButtons.OK);
                //    BeginUpdate();
                //}
            }
            else
            {
                LogMessage("AutoUpdate: No updates are available.");
            }
        }
 private static void CheckForUpdateCompleted(object sender, CheckForUpdateCompletedEventArgs e)
 {
     if (e.Error != null || !(e.UpdateAvailable))
     {
         alreadyCheckingForUpdate = false;
         return;
     }
     else
     {
         updateAvailable          = true;
         alreadyCheckingForUpdate = false;
     }
 }
Exemple #17
0
        void CurrentDeployment_CheckForUpdateCompleted(object sender, CheckForUpdateCompletedEventArgs e)
        {
            try
            {
                btnOpnieuw.Enabled = true;
                if (e.UpdateAvailable)
                {
                    lblStatus.Text       = Resources.UpdateAvailable;
                    lblNieuweVersie.Text = Resources.NewVersion + Environment.NewLine + e.AvailableVersion.ToString();

                    btnUpdate.Enabled = true;


                    string          url    = "http://pieterjan.pro/Projecten/csharp/DrawIt/UpdInf/";
                    HttpWebRequest  req    = (HttpWebRequest)WebRequest.Create(url);
                    HttpWebResponse resp   = (HttpWebResponse)req.GetResponse();
                    StreamReader    reader = new StreamReader(resp.GetResponseStream());
                    string          html   = reader.ReadToEnd();
                    Regex           rgx    = new Regex("<a href=\".*\">((?<file>.*)\\.txt)</a>");
                    Match           m      = rgx.Match(html);

                    string current = depl.CurrentVersion.ToString();
                    while (m.Success)
                    {
                        string filename = m.Groups["file"].Value;
                        if (IsLaterVersion(filename.Replace('_', '.'), current))
                        {
                            HttpWebRequest  req_info    = (HttpWebRequest)WebRequest.Create(url + filename + ".txt");
                            HttpWebResponse resp_info   = (HttpWebResponse)req_info.GetResponse();
                            StreamReader    reader_info = new StreamReader(resp_info.GetResponseStream());
                            string          info        = reader_info.ReadToEnd();

                            if (info != "")
                            {
                                textBox1.AppendText(Resources.version + " " + filename.Replace("_", ".") + ": " + info + Environment.NewLine);
                            }
                        }
                        m = m.NextMatch();
                    }
                }
                else
                {
                    lblStatus.Text = Resources.AppUpToDate;
                }
            }
            catch (Exception ex)
            {
                lblStatus.Text = Resources.SearchFailed + ex.InnerException.Message;
            }
        }
Exemple #18
0
        private void checkForUpdate_completed(object sender, CheckForUpdateCompletedEventArgs e)
        {
            if (e.Error != null)
            {
                log.Error("Could not retrieve new version of the application.");
                log.Error(e.Error.Message);
                if (this.isManualCheck)
                {
                    MessageBox.Show("Could not retrieve new version of the application.\n" + e.Error.Message, "Update Check Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                return;
            }
            else if (e.Cancelled == true)
            {
                log.Info("The update was cancelled");
                if (this.isManualCheck)
                {
                    MessageBox.Show("The update was cancelled.", "Update Check Cancelled", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }

            if (e.UpdateAvailable)
            {
                log.Info("An update is available: v" + e.AvailableVersion);

                if (!e.IsUpdateRequired)
                {
                    log.Info("This is an optional update.");
                    DialogResult dr = MessageBox.Show("An update for OGCS is available. Would you like to update the application now?", "OGCS Update Available", MessageBoxButtons.YesNo);
                    if (dr == DialogResult.Yes)
                    {
                        beginClickOnceUpdate();
                    }
                }
                else
                {
                    log.Info("This is a mandatory update.");
                    MessageBox.Show("A mandatory update for OGCS is required. The update will be installed now and the application restarted.", "OCGS Update Required", MessageBoxButtons.OK);
                    beginClickOnceUpdate();
                }
            }
            else
            {
                log.Info("Already running the latest ClickOnce version.");
                if (this.isManualCheck)   //Was a manual check, so give feedback
                {
                    MessageBox.Show("You are already running the latest ClickOnce version.", "Latest Version", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
 void CurrentDeployment_CheckForUpdateCompleted(object sender, CheckForUpdateCompletedEventArgs e)
 {
     btnOpnieuw.Enabled = true;
     if (e.UpdateAvailable)
     {
         lblStatus.Text       = Resources.UpdateAvailable;
         lblNieuweVersie.Text = res_frm.GetString("lblNieuweVersie.Text") + Environment.NewLine + e.AvailableVersion.ToString();
         btnUpdate.Enabled    = true;
     }
     else
     {
         lblStatus.Text = Resources.UpToDate;
     }
 }
Exemple #20
0
 private void Deployment_CheckForUpdateCompleted(object sender, CheckForUpdateCompletedEventArgs e)
 {
     previousState          = null;
     btnSearchAgain.Enabled = true;
     if (e.UpdateAvailable)
     {
         lblStatus.Text           = Properties.Resources.UpdateAvailable;
         lblNewVersion.Text       = e.AvailableVersion.ToString();
         btnInstallUpdate.Enabled = true;
     }
     else
     {
         lblStatus.Text = Properties.Resources.UpToDate;
     }
 }
Exemple #21
0
        private void CheckForUpdateCompleted(object sender, CheckForUpdateCompletedEventArgs e)
        {
            if (e.Error != null)
            {
                MessageBox.Show(
                    $@"[{e.Error.GetType()}]:  Could not retrieve new version of the application. Message: 
" + e.Error.Message
                    );
                // Output error to log.
                Logging.Log(e.Error);
                MessageBox.Show(e.Error.ToString());
                return;
            }
            if (e.Cancelled)
            {
                MessageBox.Show(@"The update was cancelled.");
            }

            // Check if update is available.
            if (!e.UpdateAvailable)
            {
                return;
            }

            // Ask the user if they would like to update the application now.
            if (!e.IsUpdateRequired)
            {
                var dialogResult = MessageBox.Show(
                    @"An update is available. Would you like to update the application now?",
                    @"Update Available",
                    MessageBoxButtons.OKCancel
                    );

                if (DialogResult.OK == dialogResult)
                {
                    BeginUpdate();
                }
            }
            else
            {
                MessageBox.Show(
                    @"A mandatory update is available for your application. We will install the update now, after which we will save all of your in-progress data and restart your application."
                    );
                BeginUpdate();
            }
        }
Exemple #22
0
 private void CheckForUpdatesComplete(object sender, CheckForUpdateCompletedEventArgs e)
 {
     progress.Style = ProgressBarStyle.Continuous;
     progress.Value = 0;
     if (e.Cancelled)
     {
         UpToDate = true;
         Checking = false;
         UpdateStatus();
         update.Enabled = true;
         AcceptButton   = update;
         mainLabel.Text = "Check for updates cancelled.";
         button.Text    = "Click to Update!";
         return;
     }
     if (e.Error != null)
     {
         UpToDate = true;
         Checking = false;
         UpdateStatus();
         update.Enabled = true;
         AcceptButton   = update;
         mainLabel.Text = "Error: " + e.Error.Message;
         button.Text    = "Error While Updating";
         return;
     }
     latestVersion.Text = e.AvailableVersion.ToString();
     if (e.UpdateAvailable)
     {
         if (autoInstall.Checked)
         {
             UpdateNow();
         }
         else
         {
             UpToDate = false;
             Checking = false;
             UpdateStatus();
             AcceptButton   = update;
             mainLabel.Text = "Ready for update!  Click Update Now.";
             update.Enabled = true;
             update.Text    = "&Update Now";
             button.Text    = "Update Ready";
         }
     }
 }
Exemple #23
0
 void ad_CheckForUpdateCompleted(object sender, CheckForUpdateCompletedEventArgs e)
 {
     log.Info("Update Check Complete");
     if (e.UpdateAvailable == true)
     {
         log.Info("Update Available");
         try
         {
             ad.UpdateAsync();
         }
         catch (Exception ex)
         {
             log.Error(ex);
         }
     }
     log.Info("Update Unvailable");
 }
 private void OnCheckForUpdatesCompleted(object sender, CheckForUpdateCompletedEventArgs e)
 {
     try
     {
         if (e.UpdateAvailable)
         {
             if (e.IsUpdateRequired)
             {
                 _requiredUpdateDetected = true;
             }
             ApplicationDeployment.CurrentDeployment.UpdateAsync();
         }
     }
     catch (Exception ex)
     {
         Logger.Error("Error occurred while starting async update. Excepotion" + ex.Message);
     }
 }
Exemple #25
0
        private static void HCMIS_CheckForUpdateCompleted(object sender, CheckForUpdateCompletedEventArgs e)
        {
            UpdateRunning = false;

            if (e.Error != null)
            {
                XtraMessageBox.Show("An Error occurred:\n" + e.Error.Message, "Error", MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                return;
            }

            if (!e.UpdateAvailable)
            {
                XtraMessageBox.Show("No updates found!", "HCMIS", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            if (e.Cancelled)
            {
                XtraMessageBox.Show("Update was cancelled!", "Update Cancelled", MessageBoxButtons.OK,
                                    MessageBoxIcon.Information);
                return;
            }

            if (e.UpdateAvailable)
            {
                if (e.IsUpdateRequired)
                {
                    XtraMessageBox.Show("There is a mandatory update available. Click OK to start installation", "Update Available", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    UpdateRunning = true;
                    HCMIS.UpdateAsync();
                    ShowUpdatingSignOnMainWindow();
                }

                if (XtraMessageBox.Show("Update found! Would you like to download and install the update now?", "Update Found", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    UpdateRunning = true;
                    HCMIS.UpdateAsync();
                    ShowUpdatingSignOnMainWindow();
                }
            }
        }
        void ad_CheckForUpdateCompleted(object sender, CheckForUpdateCompletedEventArgs e)
        {
            if (e.Error != null)
            {
                MessageBox.Show("ERROR: Could not retrieve new version of the application. Reason: \n" + e.Error.Message + "\nPlease report this error to the system administrator.");
                return;
            }
            else if (e.Cancelled == true)
            {
                MessageBox.Show("The update was cancelled.");
            }

            // Ask the user if they would like to update the application now.
            if (e.UpdateAvailable)
            {
                sizeOfUpdate = e.UpdateSizeBytes;

                if (!e.IsUpdateRequired)
                {
                    //DialogResult dr = MessageBox.Show("An update is available. Would you like to update the application now?\n\nEstimated Download Time: ", "Update Available", MessageBoxButtons.OKCancel);
                    //if (DialogResult.OK == dr)
                    {
                        BeginUpdate();
                    }
                }
                else
                {
                    //MessageBox.Show("A mandatory update is available for your application. We will install the update now, after which we will save all of your in-progress data and restart your application.");
                    BeginUpdate();
                }
            }
            else
            {
                //this.Hide();
                //Form1 newfrm = new Form1();
                //newfrm.t_SALJARETableAdapter.Fill(newfrm.pengvinDataset.T_SALJARE);
                //newfrm.ReparationsunderlagTableAdapter.Fill(newfrm.DataSet1.Reparationsunderlag);
                //newfrm.Show();

                backgroundWorker1.RunWorkerAsync();
            }
        }
Exemple #27
0
        void deployment_CheckForUpdateCompleted(object sender, CheckForUpdateCompletedEventArgs e)
        {
            if (e.Error == null && e.UpdateAvailable)
            {
                try
                {
                    MainWindow w = this.windows[0];
                    w.updateProgress.Value            = 0;
                    w.UpdateAvailableLabel.Visibility = Visibility.Visible;

                    deployment.UpdateAsync();
                }
                catch (InvalidOperationException ex)
                {
                    Debug.WriteLine(ex.ToString());
                    MainWindow w = this.windows[0];
                    w.UpdateAvailableLabel.Visibility = Visibility.Hidden;
                }
            }
        }
Exemple #28
0
 private void CurrentDeploymentCheckForUpdateCompleted(object sender, CheckForUpdateCompletedEventArgs e)
 {
     m_isCheckingForUpdate = false;
     if (e.Error != null)
     {
         s_log.Error("Auto update check failed", e.Error);
     }
     else
     {
         if (e.UpdateAvailable && Settings.Default.AutoInstallUpdates)
         {
             Update();
         }
         else
         {
             UpdateAvailable = e.UpdateAvailable;
         }
         s_log.Info("Auto update check succeeded, update available: " + e.UpdateAvailable.ToString());
     }
 }
Exemple #29
0
        void adCheckForUpdateAsyncMin_CheckForUpdateCompleted(object sender, CheckForUpdateCompletedEventArgs e)
        {
            if (e.Error != null)
            {
                MessageBox.Show("Could not install application update. Please try again later,  or contact a system administrator.", "Application Update Error");
                return;
            }
            else if (e.Cancelled)
            {
                MessageBox.Show("The application update has been cancelled.", "Application Update Cancelled");
                return;
            }

            adCheckForUpdateAsyncMin = ApplicationDeployment.CurrentDeployment;
            if (e.MinimumRequiredVersion > adCheckForUpdateAsyncMin.CurrentVersion)
            {
                // Launch an install of the minimum required version.
                adCheckForUpdateAsyncMin.UpdateCompleted += new AsyncCompletedEventHandler(adCheckForUpdateAsyncMin_UpdateCompleted);
                adCheckForUpdateAsyncMin.UpdateAsync();
            }
        }
        private void ADUpdateAsync_CheckForUpdateCompleted(object sender, CheckForUpdateCompletedEventArgs e)
        {
            if (e.Error == null)
            {
                MessageBox.Show("ERRO: Não foi possível verificar se existe uma atualização disponível. Motivo: " + e.Error.Message + " - Por favor, notifique esse erro ao Administrador.", ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            else
            {
                if (e.Cancelled == true)
                {
                    MessageBox.Show("A atualização foi cancelada.", ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
            }

            if (e.UpdateAvailable)
            {
                sizeOfUpdate = e.UpdateSizeBytes;

                if (!e.IsUpdateRequired)
                {
                    System.Windows.Forms.DialogResult dr = MessageBox.Show("Uma nova versão foi encontrada. Deseja atualizar o sistema agora?", ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (System.Windows.Forms.DialogResult.Yes == dr)
                    {
                        BeginUpdate();
                    }
                }
                else
                {
                    MessageBox.Show("Uma nova versão obrigatória foi encontrada. Essa atualização é obrigatória e após, o sistema será reiniciado.");
                    BeginUpdate();
                }
            }
            else
            {
                MessageBox.Show("Não tem atualização pendente.", ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Close();
            }
        }