Пример #1
0
        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();
            }
        }
Пример #2
0
        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();
        }