private void workbenchConnection_Clicked(object sender, EventArgs e) { try { if (_boundService.WorkbenchConnections.Count == 0) { MySqlWorkbench.LaunchSqlEditor(null); } else if (!_editorMenu.HasDropDownItems) { MySqlWorkbench.LaunchSqlEditor(_boundService.WorkbenchConnections[0].Name); } else { for (int x = 0; x < _editorMenu.DropDownItems.Count; x++) { if (sender == _editorMenu.DropDownItems[x]) { MySqlWorkbench.LaunchSqlEditor(_boundService.WorkbenchConnections[x].Name); } } } } catch (Exception ex) { Program.MySqlNotifierErrorHandler(Resources.FailureToLaunchWorkbench, true, ex); } }
/// <summary> /// Event delegate method fired when the <see cref="ConfigureMenuItem"/> menu itemText is clicked. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SqlEditorMenuItem_Click(object sender, EventArgs e) { try { if (BoundInstance.RelatedConnections.Count == 0) { MySqlWorkbench.LaunchSqlEditor(null); } else if (!SqlEditorMenuItem.HasDropDownItems) { MySqlWorkbench.LaunchSqlEditor(BoundInstance.WorkbenchConnection.Name); } else { for (int i = 0; i < SqlEditorMenuItem.DropDownItems.Count; i++) { if (sender == SqlEditorMenuItem.DropDownItems[i]) { MySqlWorkbench.LaunchSqlEditor(BoundInstance.RelatedConnections[i].Name); } } } } catch (Exception ex) { Program.MySqlNotifierErrorHandler(Resources.FailureToLaunchWorkbench, true, ex); } }
/// <summary> /// Event delegate method fired when the <see cref="ConfigureMenuItem"/> menu itemText is clicked. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SqlEditorMenuItem_Click(object sender, EventArgs e) { if (!(sender is ToolStripMenuItem menuItem) || (!(menuItem.Tag is MySqlWorkbenchConnection connection))) { return; } MySqlWorkbench.LaunchSqlEditor(connection.Name); }