private void MySQLConnBackgroundWorker_DoWork(object sender, DoWorkEventArgs e) { if (mysql != null) { MySQLTestResult = mysql.TestMySQLConnection(); } }
private void LootCreator_Load(object sender, EventArgs e) { mysql = new SQLMethods(Settings.Default.MySQLHost, Settings.Default.MySQLPort, Settings.Default.MySQLUsername, Settings.Default.MySQLPassword); bool testMySQL = mysql.TestMySQLConnection(); if (!testMySQL) { TaskDialog.Show(new TaskDialogInfo("Error", eTaskDialogIcon.Stop, "Could Not Connect To MySQL", String.Empty, eTaskDialogButton.Ok)); finished = true; this.Close(); } if (editor) { lootInfoBackgroundWorker.RunWorkerAsync(); } }
private void wizard_WizardPageChanging(object sender, WizardCancelPageChangeEventArgs e) { if (e.OldPage == TCMTypeWizardPage && e.PageChangeSource == eWizardPageChangeSource.NextButton) { switch (localRemoteComboBoxEX.SelectedIndex) { case 0: e.NewPage = localWizardPage; break; case 1: e.NewPage = raWizardPage; break; } } else if (e.OldPage == raWizardPage && e.PageChangeSource == eWizardPageChangeSource.NextButton) { if (hostTextBoxX.Text != String.Empty && portIntegerInput.Value != 0 && usernameTextBoxX.Text != String.Empty && passwordTextBoxX.Text != String.Empty) { remoteAccess = true; } else { e.Cancel = true; } } else if (e.OldPage == localWizardPage && e.PageChangeSource == eWizardPageChangeSource.NextButton) { if (trinityFolderTextBoxX.Text == String.Empty) { e.Cancel = true; } else { e.NewPage = MySQLWizardPage; } } else if (e.OldPage == MySQLWizardPage && e.PageChangeSource == eWizardPageChangeSource.NextButton) { if (MySQLHostTextBoxX.Text != String.Empty && MySQLIntegerInputX.Value != 0 && MySQLUsernameTextBoxX.Text != String.Empty && MySQLPasswordTextBoxX.Text != String.Empty) { host = MySQLHostTextBoxX.Text; port = MySQLIntegerInputX.Value; username = MySQLUsernameTextBoxX.Text; password = MySQLPasswordTextBoxX.Text; MySQLTestConnectionProgressBarX.Visible = true; mysql = new SQLMethods(host, port, username, password); if (mysql != null) { bool MySQLTest = mysql.TestMySQLConnection(); Application.DoEvents(); MySQLTestConnectionProgressBarX.Visible = false; if (MySQLTest) { switch (MySQLNewExistComboBoxEX.SelectedIndex) { case 0: //New Database e.NewPage = setupTCDBWizardPage; break; case 1: //Existing Database e.NewPage = ExistingTCDBWizardPage; break; } } else { e.Cancel = true; TaskDialog.Show(new TaskDialogInfo("Error", eTaskDialogIcon.Stop, "An error has occured!", "Could not connect to MySQL!", eTaskDialogButton.Ok)); } } } else { e.Cancel = true; } } else if ((e.OldPage == localWizardPage || e.OldPage == raWizardPage) && e.PageChangeSource == eWizardPageChangeSource.NextButton) { if (MySQLHostTextBoxX.Text == String.Empty || portIntegerInput.Value == 0 || MySQLUsernameTextBoxX.Text == String.Empty || MySQLPasswordTextBoxX.Text == String.Empty) { e.Cancel = true; } } else if (e.OldPage == setupTCDBWizardPage && e.PageChangeSource == eWizardPageChangeSource.NextButton) { if (remoteAccess) { e.NewPage = finishedWizardPage; } else { e.NewPage = otherWizardPage; } } else if (e.OldPage == ExistingTCDBWizardPage && e.PageChangeSource == eWizardPageChangeSource.NextButton) { if (MySQLAuthDBTextBoxX.Text == String.Empty || MySQLCharDBTextBoxX.Text == String.Empty || MySQLWorldDBTextBoxX.Text == String.Empty) { e.Cancel = true; } else { aDB = MySQLAuthDBTextBoxX.Text; cDB = MySQLCharDBTextBoxX.Text; wDB = MySQLWorldDBTextBoxX.Text; if (remoteAccess) { e.NewPage = finishedWizardPage; } else { e.NewPage = otherWizardPage; } } } if (e.NewPage == setupTCDBWizardPage) { setupTCDBWizardPage.NextButtonEnabled = eWizardButtonState.False; } }