private Connection getConnection(Connection c)
 {
     foreach (Connection conn in this.connections) // Loop through List with foreach
     {
         if (conn.name == c.name)
         {
             return conn;
         }
     }
     return null;
 }
        private void btnConnect_Click(object sender, EventArgs e)
        {
            Connection c = new Connection();
            c.Address = txtAddress.Text;
            c.Port = txtPort.Text;
            c.Username = txtUsername.Text;
            c.Password = txtPassword.Text;

            if (parentWindow != null)
                parentWindow.connect(null, c);

            closeWindow();
        }
 internal void removeConnection(Connection currentConnection)
 {
     connections.Remove(getConnection(currentConnection));
 }
 public bool connectionExists(Connection c)
 {
     return connectionExists(c.name);
 }