Beispiel #1
0
        /// <summary>
        /// Downloads update and installs the update
        /// </summary>
        /// <param name="update">The update xml info</param>
        private void DownloadUpdate(AutoUpdateXml update)
        {
            AutoUpdateDownloadForm form   = new AutoUpdateDownloadForm(this.applicationInfo, update.Uri, update.MD5, this.applicationInfo.ApplicationIcon);
            DialogResult           result = form.ShowDialog(this.applicationInfo.Context);

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

                // "Install" it
                AutoClosingMessageBox.Show(this.applicationInfo.Context,
                                           lang.getString("autoUpdater_msg_success"),
                                           lang.getString("autoUpdater_msg_success_title"),
                                           5000);
                UpdateApplication(form.TempFilePath, currentPath, newPath, update.LaunchArgs);

                Application.Exit();
            }
            else if (result == DialogResult.Abort)
            {
                MessageBoxEx.Show(this.applicationInfo.Context,
                                  lang.getString("autoUpdater_msg_terminated"),
                                  lang.getString("autoUpdater_msg_terminated_title"),
                                  MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBoxEx.Show(this.applicationInfo.Context,
                                  lang.getString("autoUpdater_msg_failed"),
                                  lang.getString("autoUpdater_msg_failed_title"),
                                  MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Downloads update and installs the update
        /// </summary>
        /// <param name="update">The update xml info</param>
        private void DownloadUpdate(AutoUpdateXml update)
        {
            AutoUpdateDownloadForm form = new AutoUpdateDownloadForm(this.applicationInfo, update.Uri, update.MD5, this.applicationInfo.ApplicationIcon);
            DialogResult result = form.ShowDialog(this.applicationInfo.Context);

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

                // "Install" it
                AutoClosingMessageBox.Show(this.applicationInfo.Context,
                                            lang.getString("autoUpdater_msg_success"),
                                            lang.getString("autoUpdater_msg_success_title"),
                                            5000);
                UpdateApplication(form.TempFilePath, currentPath, newPath, update.LaunchArgs);

                Application.Exit();
            }
            else if (result == DialogResult.Abort)
            {
                MessageBoxEx.Show(this.applicationInfo.Context,
                                    lang.getString("autoUpdater_msg_terminated"),
                                    lang.getString("autoUpdater_msg_terminated_title"),
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBoxEx.Show(this.applicationInfo.Context,
                                    lang.getString("autoUpdater_msg_failed"),
                                    lang.getString("autoUpdater_msg_failed_title"),
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }