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, false, Helpers.ElyOrGreater(Connection) ? Branding.UpdateIso : Branding.Update); if (downloadAction != null) { downloadAction.Changed += downloadAndUnzipXenServerPatchAction_Changed; downloadAction.Completed += downloadAndUnzipXenServerPatchAction_Completed; } downloadAction.RunExternal(session); }
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 }; action.Completed += s => { if (action.Succeeded) { Program.Invoke(Program.MainWindow, () => { 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); } }); } }; dialog.Show(this); }
private void ToolStripMenuItemDownload_Click(object sender, EventArgs e) { 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(); var hosts = patchAlert.DistinctHosts; if (hosts.Count > 0) { wizard.SelectServers(hosts); if (wizard.CurrentStepTabPage.EnableNext()) { wizard.NextStep(); } } else { string disconnectedServerNames = dataGridViewUpdates.SelectedRows[0].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); } } }