Esempio n. 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;
            }

            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();

                    using (var dlg = new ThreeButtonDialog(
                               new ThreeButtonDialog.Details(SystemIcons.Warning,
                                                             string.Format(Messages.UPDATES_WIZARD_DISCONNECTED_SERVER,
                                                                           disconnectedServerNames),
                                                             Messages.UPDATES_WIZARD)))
                    {
                        dlg.ShowDialog(this);
                    }
                }
            });
        }