示例#1
0
        private void downloadUpdate(UpdateXml update, string location, UpdateAction action)
        {
            UpdateDownloader form = new UpdateDownloader(update.Uri, update.MD5, applicationInfos[0].ApplicationIcon);
            DialogResult result = form.ShowDialog(applicationInfos[0].Context);
            form.Close();

            if (result == DialogResult.OK)
            {
                string currentPath = location;
                string newPath = Path.Combine(Path.GetDirectoryName(currentPath), update.FileName);
                if (action == UpdateAction.RESTART)
                    updateApplication(form.TempFilePath, currentPath, newPath, update.LaunchArgs, false);
                else if (action == UpdateAction.INSTALL)
                    updateApplication(form.TempFilePath, currentPath, newPath, update.LaunchArgs, true);
                else if (action == UpdateAction.FILECOPY)
                    updateFile(form.TempFilePath, currentPath, newPath, update.Version.ToString());
            }
            else if (result == DialogResult.Abort)
            {
                MessageBox.Show(Strings.updateCancelled, "Update Download "+Strings.cancelled, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show(Strings.updateError, "Update Download "+Strings.error, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }