/// <summary> /// Handles the SelectedIndexChanged event of the APIMethodComboBox control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void APIMethodComboBox_SelectedIndexChanged(object sender, EventArgs e) { // Reset controls SaveButton.Enabled = false; CharacterComboBox.SelectedItem = null; IDOrNameTextBox.ResetText(); UpdateControlsVisibility(); if (!APIMethods.NonAccountGenericMethods.Contains(APIMethodComboBox.SelectedItem) || IDOrNameTextBox.Visible) { return; } LoadDocument(ApiTesterUIHelper.Url); }
/// <summary> /// Raises the <see cref="E:System.Windows.Forms.Control.KeyPress"/> event. /// </summary> /// <param name="e">A <see cref="T:System.Windows.Forms.KeyPressEventArgs"/> that contains the event data.</param> protected override void OnKeyPress(KeyPressEventArgs e) { base.OnKeyPress(e); if (!e.KeyChar.Equals((char)Keys.Escape)) { return; } if (IDOrNameTextBox.Focused) { IDOrNameTextBox.ResetText(); } else if (KeyIDTextBox.Focused) { KeyIDTextBox.ResetText(); } else if (VCodeTextBox.Focused) { VCodeTextBox.ResetText(); } else if (CharIDTextBox.Focused) { CharIDTextBox.ResetText(); } else { foreach (TextBox textBox in HeaderPanel.Controls.OfType <TextBox>()) { textBox.CausesValidation = false; } Close(); } e.Handled = true; }