Example #1
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);
                }
            }
        }
Example #2
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;

            Program.Invoke(Program.MainWindow, () =>
            {
                var wizard = new PatchingWizard();
                wizard.Show();
                wizard.NextStep();
                wizard.AddAlert(patchAlert);
                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);
                 }
            });
        }
Example #3
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);
                }
            }
        }