/// <summary> /// Adds a given connection to the corresponding connections group list depending on its connection type (local VS remote). /// </summary> /// <param name="conn">Object containing the data to open a connection, normally shared with Workbench.</param> private void AddConnectionToList(MySqlWorkbenchConnection conn) { if (conn == null || ConnectionsList.HeaderNodes.Count < 2) { return; } var headerNode = ConnectionsList.HeaderNodes[conn.IsLocalConnection ? 0 : 1]; var node = ConnectionsList.AddConnectionNode(headerNode, conn); node.Enable = true; switch (conn.ConnectionMethod) { case MySqlWorkbenchConnection.ConnectionMethodType.Tcp: node.ImageIndex = 0; break; case MySqlWorkbenchConnection.ConnectionMethodType.LocalUnixSocketOrWindowsPipe: node.ImageIndex = 1; break; case MySqlWorkbenchConnection.ConnectionMethodType.Ssh: node.ImageIndex = node.Enable ? 2 : 4; break; case MySqlWorkbenchConnection.ConnectionMethodType.XProtocol: // This connection is deprecated and code should not hit this case, but this is left as a safeguard. node.Enable = false; node.ImageIndex = node.Enable ? 3 : 5; break; } }
/// <summary> /// Adds a given connection to the corresponding connections group list depending on its connection type (local VS remote). /// </summary> /// <param name="conn">Object containing the data to open a connection, normally shared with Workbench.</param> private void AddConnectionToList(MySqlWorkbenchConnection conn) { if (conn == null || ConnectionsList.HeaderNodes.Count < 2) { return; } var isSsh = conn.DriverType == MySqlWorkbenchConnectionType.Ssh; var headerNode = ConnectionsList.HeaderNodes[conn.IsLocalConnection ? 0 : 1]; var node = ConnectionsList.AddConnectionNode(headerNode, conn); node.Enable = !isSsh; switch (conn.DriverType) { case MySqlWorkbenchConnectionType.Tcp: case MySqlWorkbenchConnectionType.NamedPipes: node.ImageIndex = conn.IsFabricManaged ? 4 : (node.Enable ? 0 : 1); break; case MySqlWorkbenchConnectionType.Ssh: node.ImageIndex = node.Enable ? 2 : 3; break; } }