private void DownloadPatchFile(XenServerPatchAlert patch)
        {
            if(string.IsNullOrEmpty(patch.Patch.PatchUrl))
            {
                Results.Add("Patch conatined no URL: " + patch.Patch.Name);
                return;
            }

            string tempFileName = NewTempPath();
            DownloadAndUnzipXenServerPatchAction action = new DownloadAndUnzipXenServerPatchAction(patch.Patch.Name, 
                                                                    new Uri(patch.Patch.PatchUrl), 
                                                                    tempFileName);
            try
            {
                Status = "Download and unzip patch " + patch.Patch.Name;

                ConsoleSpinner spinner = new ConsoleSpinner();
                action.RunAsync();
                while(!action.IsCompleted)
                {
                    spinner.Turn(action.PercentComplete);
                }
                
                if(!action.Succeeded)
                    Results.Add("Patch download and unzip unsuccessful: " + action.Exception.Message);
            }
            catch (Exception ex)
            {
                Results.Add("Patch download error: " + ex.Message);
            }

        }
        private void DownloadFile()
        {
            string patchUri = ((XenServerPatchAlert)SelectedUpdateAlert).Patch.PatchUrl;
            if (string.IsNullOrEmpty(patchUri))
                return;

            Uri address = new Uri(patchUri);
            string tempFile = Path.GetTempFileName();

            bool isIso = SelectedUpdateType == UpdateType.ISO;

            downloadAction = new DownloadAndUnzipXenServerPatchAction(SelectedUpdateAlert.Name, address, tempFile, isIso ? Branding.UpdateIso : Branding.Update);

            if (downloadAction != null)
            {
                downloadAction.Changed += singleAction_Changed;
                downloadAction.Completed += singleAction_Completed;
            }

            downloadAction.RunAsync();

            flickerFreeListBox1.Items.Clear();
            flickerFreeListBox1.Items.Add(downloadAction);
            flickerFreeListBox1.Refresh();
            OnPageUpdated();

            UpdateActionProgress(downloadAction);
        }
Beispiel #3
0
        private void ToolStripMenuItemDownload_Click(object sender, EventArgs e)
        {
            DataGridViewRow clickedRow = FindAlertRow(sender as ToolStripMenuItem);
            if (clickedRow == null)
                return;

            XenServerPatchAlert patchAlert = (XenServerPatchAlert) clickedRow.Tag;

            if (patchAlert == null)
                return;

            string patchUri = patchAlert.Patch.PatchUrl;
            if (string.IsNullOrEmpty(patchUri))
                return;

            Uri address = new Uri(patchUri);
            string tempFile = Path.GetTempFileName();

            var action = new DownloadAndUnzipXenServerPatchAction(patchAlert.Description, address, tempFile);
            ActionProgressDialog dialog = new ActionProgressDialog(action, ProgressBarStyle.Continuous, false) { ShowCancel = true };
            dialog.ShowDialog(this);

            if (action.Succeeded)
            {
                var wizard = new PatchingWizard();
                wizard.Show();
                wizard.NextStep();
                wizard.AddFile(action.PatchPath);
                wizard.NextStep();

                var hosts = patchAlert.DistinctHosts;
                if (hosts.Count > 0)
                {
                    wizard.SelectServers(hosts);
                }
                else
                {
                    string disconnectedServerNames = clickedRow.Cells[ColumnLocation.Index].Value.ToString();

                    new ThreeButtonDialog(
                        new ThreeButtonDialog.Details(SystemIcons.Warning,
                                                      string.Format(Messages.UPDATES_WIZARD_DISCONNECTED_SERVER,
                                                                    disconnectedServerNames),
                                                      Messages.UPDATES_WIZARD)).ShowDialog(this);
                }
            }
        }
Beispiel #4
0
        private void DownloadAndInstall()
        {
            if (dataGridViewUpdates.SelectedRows.Count == 0)
                return;

            XenServerPatchAlert patchAlert = dataGridViewUpdates.SelectedRows[0].Tag as XenServerPatchAlert;
            if (patchAlert == null)
                return;

            string patchUri = patchAlert.Patch.PatchUrl;
            if (string.IsNullOrEmpty(patchUri))
                return;

            Uri address = new Uri(patchUri);
            string tempFile = Path.GetTempFileName();

            var action = new DownloadAndUnzipXenServerPatchAction(patchAlert.Description, address, tempFile);
            ActionProgressDialog dialog = new ActionProgressDialog(action, ProgressBarStyle.Continuous, false) { ShowCancel = true };
            dialog.ShowDialog(this);

            if (action.Succeeded)
            {
                var wizard = new PatchingWizard();
                wizard.Show();
                wizard.NextStep();
                wizard.AddFile(action.PatchPath);
                wizard.NextStep();
                if (patchAlert.Hosts.Count > 0)
                {
                    wizard.SelectServers(patchAlert.Hosts);
                    wizard.NextStep();
                }
                else
                {
                    string disconnectedServerNames =
                        dataGridViewUpdates.SelectedRows[0].Cells[ColumnAppliesTo.Index].Value.ToString();

                    new ThreeButtonDialog(
                        new ThreeButtonDialog.Details(SystemIcons.Warning,
                                                      string.Format(Messages.UPDATES_WIZARD_DISCONNECTED_SERVER,
                                                                    disconnectedServerNames),
                                                      Messages.UPDATES_WIZARD)).ShowDialog(this);
                }
            }
        }
        private void DownloadFile(ref Session session)
        {
            string patchUri = patch.PatchUrl;
            if (string.IsNullOrEmpty(patchUri))
                return;

            Uri address = new Uri(patchUri);
            tempFileName = Path.GetTempFileName();

            var downloadAction = new DownloadAndUnzipXenServerPatchAction(patch.Name, address, tempFileName, Helpers.ElyOrGreater(Connection) ? Branding.UpdateIso : Branding.Update);

            if (downloadAction != null)
            {
                downloadAction.Changed += downloadAndUnzipXenServerPatchAction_Changed;
                downloadAction.Completed += downloadAndUnzipXenServerPatchAction_Completed;
            }

            downloadAction.RunExternal(session);
        }