Example #1
0
        /// <summary>
        /// Event delegate method fired when the button to connect to the database is clicked.
        /// </summary>
        /// <param name="sender">Sender object.</param>
        /// <param name="e">Event arguments.</param>
        protected void ConnectButtonClick(object sender, EventArgs e)
        {
            try
            {
                using (var connectDialog = new ConnectDialog())
                {
                    connectDialog.Connection = Connection;
                    if (connectDialog.ShowDialog() == DialogResult.Cancel)
                    {
                        return;
                    }

                    // Check if the MySQL Server version supports the X Protocol.
                    if (IsHybrid && !connectDialog.Connection.ServerVersionSupportsXProtocol(false))
                    {
                        InfoDialog.ShowDialog(InfoDialogProperties.GetWarningDialogProperties(Resources.WarningText,
                                                                                              Resources.NewConnectionNotXProtocolCompatibleDetail, null,
                                                                                              Resources.NewConnectionNotXProtocolCompatibleMoreInfo));
                        return;
                    }

                    SetConnection(connectDialog.Connection, connectDialog.ConnectionName);
                    ClearResults();
                }
            }
            catch (MySqlException ex)
            {
                MySqlSourceTrace.WriteAppErrorToLog(ex, Resources.NewConnectionErrorDetail, Resources.NewConnectionErrorSubDetail, true);
            }
        }
Example #2
0
        private void connectButton_Click(object sender, EventArgs e)
        {
            resultsPage.Hide();
            ConnectDialog d = new ConnectDialog();

            d.Connection = connection;
            DialogResult r = d.ShowDialog();

            if (r == DialogResult.Cancel)
            {
                return;
            }
            connection = d.Connection;
            UpdateButtons();
        }