private void btnconnect_Click(object sender, EventArgs e) { Utilities.runInThread(() => { Globals.ConnectionStr(txtSHost.Text, txtSUser.Text, txtSPass.Text, txtSDatabase.Text); if (Utilities.AsyncDB().Connected()) { Globals.Connected = true; } else { Globals.Connected = false; } if (Globals.Connected) { if (checkBoxRemember.Checked) { Settings.save("StoredSettings", checkBoxRemember.Checked.ToString(), checkBoxAutoConnect.Checked.ToString(), txtSHost.Text, txtSUser.Text, txtSPass.Text, txtSDatabase.Text); } else { Settings.delete("StoredSettings"); } Utilities.InvokeMe(btnconnect, () => { btnconnect.Text = "Reconnect"; }); Utilities.notifyThem(ntfBox3, "Successfully Connected", NotificationBox.Type.Success); } else { Utilities.notifyThem(ntfBox3, "Could not connect to the Database", NotificationBox.Type.Error); } }).Start(); }
public static DB AsyncDB(bool DebugMe = false) { DB tempDB = new DB(Globals.ConnectionStr()); tempDB.Debug = DebugMe; return(tempDB); }