예제 #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;
        }
예제 #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();
            }
              }
            }
              }
        }
예제 #3
0
파일: fmMain.cs 프로젝트: nagilum/myscue
        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);
              }
        }