/// <summary> /// Event delegate method fired when the <see cref="EditConnectionToolStripMenuItem"/> context menu item is clicked. /// </summary> /// <param name="sender">Sender object.</param> /// <param name="e">Event arguments.</param> private void EditConnectionToolStripMenuItem_Click(object sender, EventArgs e) { if (WorkbenchConnectionsListView.SelectedItems.Count == 0) { return; } if (!(WorkbenchConnectionsListView.SelectedItems[0].Tag is MySqlWorkbenchConnection workbenchConnection)) { return; } using (var instanceConnectionDialog = new MySqlWorkbenchConnectionDialog(workbenchConnection, false)) { instanceConnectionDialog.Icon = Resources.MySqlNotifierIcon; instanceConnectionDialog.ShowIcon = true; if (instanceConnectionDialog.ShowIfWorkbenchNotRunning() != DialogResult.OK) { return; } } InstancesListChanged = true; RefreshMySqlInstancesList(false); }
/// <summary> /// Event delegate method fired when the <see cref="AddConnectionButton"/> button is clicked. /// </summary> /// <param name="sender">Sender object.</param> /// <param name="e">Event arguments.</param> private void AddConnectionButton_Click(object sender, EventArgs e) { using (var instanceConnectionDialog = new MySqlWorkbenchConnectionDialog(null, true)) { instanceConnectionDialog.Icon = Resources.__TemplateIcon; instanceConnectionDialog.ShowIcon = true; if (instanceConnectionDialog.ShowIfWorkbenchNotRunning() != DialogResult.OK) { return; } } RefreshConnectionsList(false); }
/// <summary> /// Event delegate method fired when the <see cref="AddConnectionButton"/> button is clicked. /// </summary> /// <param name="sender">Sender object.</param> /// <param name="e">Event arguments.</param> private void AddConnectionButton_Click(object sender, EventArgs e) { using (var instanceConnectionDialog = new MySqlWorkbenchConnectionDialog(null, false)) { instanceConnectionDialog.Icon = Resources.MySqlNotifierIcon; instanceConnectionDialog.ShowIcon = true; if (instanceConnectionDialog.ShowIfWorkbenchNotRunning() != DialogResult.OK) { return; } } InstancesListChanged = true; RefreshMySqlInstancesList(false); }
/// <summary> /// Event delegate method fired when the <see cref="EditConnectionToolStripMenuItem"/> context menu item is clicked. /// </summary> /// <param name="sender">Sender object.</param> /// <param name="e">Event arguments.</param> private void EditConnectionToolStripMenuItem_Click(object sender, EventArgs e) { if (WorkbenchConnectionsListView.SelectedItems.Count == 0) { return; } var workbenchConnection = WorkbenchConnectionsListView.SelectedItems[0].Tag as MySqlWorkbenchConnection; if (workbenchConnection == null) { return; } using (var instanceConnectionDialog = new MySqlWorkbenchConnectionDialog(workbenchConnection, true)) { instanceConnectionDialog.Icon = Resources.__TemplateIcon; instanceConnectionDialog.ShowIcon = true; var oldConnectionName = workbenchConnection.Name; if (instanceConnectionDialog.ShowIfWorkbenchNotRunning() != DialogResult.OK) { return; } if (workbenchConnection.Name != oldConnectionName) { // Update name in server explorer var package = MySqlDataProviderPackage.Instance; var serverExplorerConnections = package.GetMySqlConnections(); foreach (var connection in serverExplorerConnections) { if (connection.DisplayName != oldConnectionName) { continue; } connection.DisplayName = workbenchConnection.Name; package.UpdateMySqlConnectionNames(); break; } } } RefreshConnectionsList(false); }
/// <summary> /// Event delegate method fired when the <see cref="EditConnectionToolStripMenuItem"/> context-menu item is clicked. /// </summary> /// <param name="sender">Sender object.</param> /// <param name="e">Event arguments.</param> private void EditConnectionToolStripMenuItem_Click(object sender, EventArgs e) { var selectedNode = ConnectionsList.SelectedNode; if (selectedNode == null || selectedNode.Type != MySqlListViewNode.MySqlNodeType.Connection || selectedNode.WbConnection == null) { return; } var connectionToEdit = ConnectionsList.SelectedNode.WbConnection; bool editedConnection; using (var instanceConnectionDialog = new MySqlWorkbenchConnectionDialog(connectionToEdit)) { editedConnection = instanceConnectionDialog.ShowIfWorkbenchNotRunning() == DialogResult.OK; } if (editedConnection) { LoadConnections(false); } }