Exemplo n.º 1
0
        private void LoadDatbaseWithHostName()
        {
            if (cb_server.Text != "localhost")
            {
                return;
            }

            new SSequence(this)
            .Then(() =>
            {
                FGuest.showWaiting(true);
                List <string> dbs = busSql.GetListDatabaseNameLocal();
                cb_db.Items.Clear();
                dbs.ForEach((string name) => cb_db.Items.Add(name));
            }
                  )
            .callTimeout(500, () => FGuest.showWaiting(false))
            .Start();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Khi người dùng click cấu hình
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_config_Click(object sender, EventArgs e)
        {
            DTO.DTOSql sqlDeltail = new DTO.DTOSql();
            sqlDeltail.AuthWin = dd_auth.selectedValue != TYPE_AUTH_SQL;
            sqlDeltail.Server  = cb_server.Text;
            sqlDeltail.DB      = cb_db.Text;
            sqlDeltail.User    = txb_user.Text;
            sqlDeltail.Pass    = txb_password.Text;

            SInvokeEvent cb = new SInvokeEvent(this);

            cb.Wait = (obj) =>
            {
                FGuest.showWaiting(true);
            };

            cb.Error = (obj) =>
            {
                SFunction.SetTimeOut(
                    () => {
                    Invoke((Action)(() => FGuest.showWaiting(false)));
                    MessageBox.Show("Cấu hình bị lỗi!");
                }
                    , 500);
            };

            cb.Success = (obj) =>
            {
                SFunction.SetTimeOut(
                    () => {
                    Invoke((Action)(() => FGuest.showWaiting(false)));
                    MessageBox.Show("Cấu hình thành công!");
                }
                    , 500);
            };

            busSql.Config(sqlDeltail, cb);
        }