/// <summary> /// Handle selection of panels to display, including updating buttons. /// </summary> /// <param name="mainForm"></param> /// <param name="sender"></param> /// <param name="containerPanel"></param> /// <param name="panelToActivate">New panel</param> /// <param name="panelNarrativeText">Text pulled from RTF to display as header</param> /// <param name="clickOption"></param> public static void ActivateActionPanel(FrmQreMain mainForm, Button sender, Panel containerPanel, UserControl panelToActivate, string panelNarrativeText, ApButtonClickOption clickOption = ApButtonClickOption.PerformClick) { mainForm.SuspendLayout(); try { var panelThatOwnsCaller = (Panel)sender.Parent; containerPanel.Controls.Clear(); if (panelThatOwnsCaller != null) { UiStateRoutines.UnselectButtons(panelThatOwnsCaller); } UiStateRoutines.UnselectButtons(containerPanel); sender.ForeColor = Color.Green; // Clear unneeded controls foreach (Control thisControl in containerPanel.Controls) { if (thisControl is Button) { containerPanel.Controls.Remove(thisControl); } } panelToActivate.Dock = DockStyle.Fill; containerPanel.Controls.Add(panelToActivate); ActiveScreen.lblActionNarrative.Text = panelNarrativeText; if (clickOption == ApButtonClickOption.PerformClick) { var firstButton = QuickFunctions.GetTopButton(panelToActivate, ChildNavOptions.NavigateChildren); if (firstButton != null) { firstButton.PerformClick(); } else { MessageBox.Show(@"Cannot perform click for the " + panelToActivate.GetType().Name + @" action panel because it contains no buttons."); } } } finally { mainForm.ResumeLayout(); } }
private void frmQFEMain_Load(object sender, EventArgs e) { // Delete old temp files from prev runs QuickFunctions.ClearOldTemporaryFiles(); ActiveScreen = this; tcNav.TabPages.Remove(tpNfpa2Mode); tcNav.TabPages.Remove(tpTests); tcNav.SelectedIndex = 0; tcNav.SelectedTab = null; tcNav.SelectedTab = tpQraMode; // Populate fuel selection dropdowns. // One dropdown on phys UI, one on QRA. Both sync to same backend param. fuelTypePhys.DataSource = QraStateContainer.Instance.FuelTypes; fuelTypePhys.SelectedItem = QraStateContainer.GetValue <FuelType>("FuelType"); fuelTypeQra.DataSource = QraStateContainer.Instance.FuelTypes; fuelTypeQra.SelectedItem = QraStateContainer.GetValue <FuelType>("FuelType"); }