Exemplo n.º 1
0
        private void btn_Login_Click(object sender, EventArgs e)
        {
            try
            {
                this.backgroundWorker1.RunWorkerAsync();                   // 运行 backgroundWorker 组件
                JingDu form = new JingDu(this.backgroundWorker1, "后台验证中"); // 显示进度条窗体
                form.ShowDialog(this);
                form.Close();
                bool Loginpd = cals.Login(txt_User.Text.Trim(), txt_pwd.Text.Trim());

                if (Loginpd)
                {
                    MessageBox.Show("登陆成功!");

                    this.DialogResult = System.Windows.Forms.DialogResult.OK;
                    this.Close();
                }
                else
                {
                    MessageBox.Show("登录失败!原因:账号或密码错误");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("登录失败!原因:找不到账号或密码!");
            }
        }