コード例 #1
0
 /// <summary>
 /// Creates a new connection, and adds it to the connection pool.
 /// </summary>
 /// <param name="name">Name of connection.</param>
 /// <returns>Connection.</returns>
 public Connection Add(String name) 
 {
     Connection connection = new Connection(name);
     connections.Add(connection);
     return connection;
 }
コード例 #2
0
 /// <summary>
 /// Removes a connection from the connection pool.
 /// </summary>
 /// <param name="connection">Connection to remove.</param>
 public void Remove(Connection connection)
 {
     connections.Remove(connection);
 }
コード例 #3
0
        /// <summary>
        /// Connection listbox selection change event. When a new connection is selected,
        /// connection details are displayed in the server details section.
        /// </summary>
        /// <param name="sender">Sender.</param>
        /// <param name="e">Event arguments.</param>
        private void listBox_installations_SelectedIndexChanged(object sender, EventArgs e)
        {
            // Selected connection
            Connection selected = (Connection)listBox_installations.SelectedItem;

            if (selected != null)
            {
                if (selected != active_selection)
                {
                    active_selection = selected;
                    textBox_name.Text = selected.Name;
                    textBox_host.Text = selected.Host;
                    textBox_path.Text = selected.Path;
                    textBox_username.Text = selected.Username;
                    textBox_password.Text = selected.Password;
                    
                    // translate -1 as null
                    if (selected.Port == -1)
                    {
                        textBox_port.Text = "";
                    }
                    else
                    {
                        textBox_port.Text = selected.Port.ToString();
                    }
                    
                    valid_form();
                }
            }
        }