Ejemplo n.º 1
0
        private void btAdd_Click(object sender, EventArgs e)
        {
            fmConnection dialog = new fmConnection();

              if (dialog.ShowDialog(this) == System.Windows.Forms.DialogResult.OK) {
            Connections.Add(dialog.connection);
            this.populateList();
              }

              this.DialogResult = System.Windows.Forms.DialogResult.None;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Opens the selected connection for edit.
        /// </summary>
        /// <param name="duplicate">Whether or not to duplicate the selected connection, or edit.</param>
        private void editSelectedConnection(bool duplicate = false)
        {
            if (this.lvConnections.SelectedItems.Count > 0) {
            uint id = 0;

            if (uint.TryParse(this.lvConnections.SelectedItems[0].Tag.ToString(), out id)) {
              MySQLConnection connection = Connections.MySQLConnections.SingleOrDefault(c => c.ID == id);

              if (connection != null) {
            fmConnection dialog = new fmConnection();

            MySQLConnection temp = new MySQLConnection() {
              ID = (duplicate ? 0 : connection.ID),
              Name = connection.Name + (duplicate ? " (duplicate)" : ""),

              MySQLHostname = connection.MySQLHostname,
              MySQLPort = connection.MySQLPort,
              MySQLUsername = connection.MySQLUsername,
              MySQLPassword = connection.MySQLPassword,
              MySQLDefaultDatabase = connection.MySQLDefaultDatabase,

              SSHHostname = connection.SSHHostname,
              SSHPort = connection.SSHPort,
              SSHUsername = connection.SSHUsername,
              SSHPassword = connection.SSHPassword,
              LocalForwardedPort = connection.LocalForwardedPort,

              LoadTablesOnServerConnect = connection.LoadTablesOnServerConnect,
              ViewTablesOnServerConnect = connection.ViewTablesOnServerConnect,
              ViewLogOnServerConnect = connection.ViewLogOnServerConnect,
            };

            dialog.connection = temp;

            if (dialog.ShowDialog(this) == System.Windows.Forms.DialogResult.OK) {
              Connections.Add(dialog.connection);
              this.populateList();
            }
              }
            }
              }
        }
Ejemplo n.º 3
0
        private void miConnections_QuickConnect_Click(object sender, EventArgs e)
        {
            fmConnection dialog = new fmConnection();

              if (dialog.ShowDialog(this) == System.Windows.Forms.DialogResult.OK) {
            this.connectToServer(dialog.connection);
              }
        }