private void buttonConnect_Click(object sender, EventArgs e) { bool succesConnection = true; var builder = new MySqlConnectionStringBuilder(); builder.Server = textBoxAddress.Text.Trim(); builder.UserID = textBoxUsername.Text.Trim(); builder.Password = textBoxPassword.Text.Trim(); builder.Port = Convert.ToUInt16(textBoxPort.Text); builder.Database = textBoxAuth.Text.Trim(); if (!ConnectDB(builder.ToString())) { succesConnection = false; } builder.Database = textBoxCharacters.Text.Trim(); if (!ConnectDB(builder.ToString())) { succesConnection = false; } builder.Database = textBoxWorld.Text.Trim(); if (!ConnectDB(builder.ToString())) { succesConnection = false; } if (succesConnection) { SaveSettings(); Andress = textBoxAddress.Text; Port = Convert.ToUInt16(textBoxPort.Text); Username = textBoxUsername.Text; Password = textBoxPassword.Text; DatabaseAuth = textBoxAuth.Text; DatabaseCharacters = textBoxCharacters.Text; DatabaseWorld = textBoxWorld.Text; this.Hide(); var mf = new FormMain(); mf.FormClosed += (s, args) => this.Close(); mf.Show(); } }
private void buttonOffline_Click(object sender, EventArgs e) { Offline = true; SaveSettings(); this.Hide(); var mf = new FormMain(); mf.FormClosed += (s, args) => this.Close(); mf.Show(); }