private void HotfixesToolStripMenuItem_Click()

in 2LCS/Forms/MainForm.cs [1312:1367]


        private void HotfixesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Cursor = Cursors.WaitCursor;
            var menuItem = (sender as ToolStripMenuItem);
            HotfixesType hotfixesType;
            string label;
            switch (menuItem.Name)
            {
                case "cheMetadataHotfixesToolStripMenuItem":
                case "saasApplicationMetadataHotfixesToolStripMenuItem":
                    hotfixesType = HotfixesType.Metadata;
                    label = "application metadata updates";
                    break;

                case "cheApplicationBinaryHotfixesToolStripMenuItem":
                case "saasApplicationBinaryHotfixesToolStripMenuItem":
                    hotfixesType = HotfixesType.ApplicationBinary;
                    label = "application binary hotfixes";
                    break;

                case "chePlatformHotfixesToolStripMenuItem":
                case "saasPlatformBinaryHotfixesToolStripMenuItem":
                    hotfixesType = HotfixesType.PlatformBinary;
                    label = "platform binary hotfixes";
                    break;

                default:
                    //case "saasCriticalMetadataHotfixesToolStripMenuItem":
                    hotfixesType = HotfixesType.CriticalMetadata;
                    label = "critical metadata hotfixes";
                    break;
            }

            foreach (DataGridViewRow row in SelectedDataGridView.SelectedRows)
            {
                var diagId = _httpClientHelper.GetDiagEnvironmentId((CloudHostedInstance)row.DataBoundItem);
                var kbs = _httpClientHelper.GetAvailableHotfixes(diagId, (int)hotfixesType);
                if (kbs == null)
                {
                    MessageBox.Show($"Request to get available updates failed. Please try again later.");
                    continue;
                }
                if (kbs.Count == 0)
                {
                    MessageBox.Show($"There are no {label} available for {((CloudHostedInstance)row.DataBoundItem).DisplayName} instance.");
                    continue;
                }
                using var form = new AvailableKBs
                {
                    Hotfixes = kbs,
                    Text = $"{kbs.Count} {label} available for {((CloudHostedInstance)row.DataBoundItem).DisplayName} instance."
                };
                form.ShowDialog();
            }
            Cursor = Cursors.Default;
        }