Пример #1
0
        private void InitializeProgram()
        {
            this._mySqlHandler = new MySqlHandler(MySqlClient.From(
                                                      "username",
                                                      "password",
                                                      "database",
                                                      "arthur.go-ao.be"));

            _currentImages = new List <Image>();
            ChangeGameState(false);
            for (int i = 0; i < 15; i++)
            {
                Button btn = new Button()
                {
                    Dock = DockStyle.Fill,
                    BackgroundImageLayout = ImageLayout.Stretch
                };

                btn.Click += this.SelectImage;

                tlpScreens.Controls.Add(btn);
            }

            tsmiSave.Enabled = false;
        }
Пример #2
0
        /// <summary>
        /// Create a MySQL handler from <c>MySqlClient</c> object.
        /// </summary>
        /// <param name="client">The <c>MySqlClient</c> which contains the required information to create a connection.</param>
        /// <param name="sslMode">
        /// [OPTIONAL] The ssl method that gets used to connect with the DB.
        /// Default is "None". (NO SSL)
        /// </param>
        /// <see cref="MySqlClient"/>
        public MySqlHandler(MySqlClient client, string sslMode = "None")
        {
            // Create the connection string from the given data.
            string connectionString = $"Server={client.Server};" +
                                      $"Port={client.Port};" +
                                      $"SslMode={sslMode};" +
                                      $"Database={client.Database};" +
                                      $"Uid={client.UserName};" +
                                      $"Pwd={client.Password};";

            this._connection = new MySqlConnection(connectionString);
        }