/// <summary> /// API key toolbar > Add. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void addAPIKeyMenu_Click(object sender, EventArgs e) { using (ApiKeyUpdateOrAdditionWindow window = new ApiKeyUpdateOrAdditionWindow()) { window.ShowDialog(this); } }
/// <summary> /// API key toolbar > Edit. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void editAPIKeyMenu_Click(object sender, EventArgs e) { APIKey apiKey = apiKeysListBox.APIKeys.ElementAt(apiKeysListBox.SelectedIndex); using (ApiKeyUpdateOrAdditionWindow window = new ApiKeyUpdateOrAdditionWindow(apiKey)) { window.ShowDialog(this); } }
/// <summary> /// On double click, forces the edition. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void apiKeysListBox_MouseDoubleClick(object sender, MouseEventArgs e) { // Search for the double-clicked item int index = 0; foreach (APIKey apiKey in apiKeysListBox.APIKeys) { Rectangle rect = apiKeysListBox.GetItemRectangle(index); index++; if (!rect.Contains(e.Location)) { continue; } // Open the edition window using (ApiKeyUpdateOrAdditionWindow window = new ApiKeyUpdateOrAdditionWindow(apiKey)) { window.ShowDialog(this); return; } } }
/// <summary> /// On double click, forces the edition. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void apiKeysListBox_MouseDoubleClick(object sender, MouseEventArgs e) { // Search for the double-clicked item int index = 0; foreach (APIKey apiKey in apiKeysListBox.APIKeys) { Rectangle rect = apiKeysListBox.GetItemRectangle(index); index++; if (!rect.Contains(e.Location)) continue; // Open the edition window using (ApiKeyUpdateOrAdditionWindow window = new ApiKeyUpdateOrAdditionWindow(apiKey)) { window.ShowDialog(this); return; } } }