示例#1
0
 /// <summary>
 /// 发送验证码回调函数
 /// </summary>
 /// <param name="state"></param>
 /// <param name="data"></param>
 private void ButtonVerify_Callback(bool state, byte[] data)
 {
     ClassStatic.Result resultData = ClassStatic.GetResult(data);
     this.Invoke(new Action(() => {
         if (resultData != null)
         {
             if (resultData.ret == "true")
             {
                 buttonVerify.ForeColor = Color.Black;
                 buttonVerify.BackColor = Color.WhiteSmoke;
                 buttonVerify.Cursor    = Cursors.No;
                 buttonVerify.Text      = timeVerify.ToString();
                 timerVerify.Start();
             }
             else
             {
                 LabelTipShow(resultData.msg);
             }
         }
         else
         {
             LabelTipShow("发送验证码失败");
         }
     }));
 }
 /// <summary>
 /// 登录回调函数
 /// </summary>
 /// <param name="state"></param>
 /// <param name="data"></param>
 private void LabelLogin_Callback(bool state, byte[] data)
 {
     ClassStatic.Result resultData = ClassStatic.GetResult(data);
     if (state && resultData != null)
     {
         if (resultData.ret == "true")
         {
             this.Invoke(new Action(() => {
                 string remember = checkBoxRemember.Checked ? "true" : "false";
                 ClassStatic.SetConfig("account", inputAccount.Text);
                 ClassStatic.SetConfig("password", inputPassword.Text);
                 ClassStatic.SetConfig("remember", remember);
                 FormLogin.formLogin.LoginSuccess(inputAccount.Text);
             }));
         }
         else
         {
             FormLogin.formLogin.LabelTipShow(resultData.msg);
         }
     }
     else
     {
         FormLogin.formLogin.LabelTipShow("登录失败,请检查网络");
     }
 }
        private void TimerQrcode_Callback(bool state, byte[] data)
        {
            ClassStatic.Result resultData = ClassStatic.GetResult(data);
            System.Diagnostics.Debug.WriteLine(resultData.ret);
            if (state && resultData != null)
            {
                switch (resultData.ret)
                {
                case "0":
                    //登录成功
                    this.Invoke(new Action(() => {
                        FormLogin.formLogin.LoginSuccess(resultData.data);
                        pictureQRcode.Image.Dispose();
                        pictureQRcode.Image = Properties.Resources.qrcodeInvalid;
                        labelTip.Text       = "二维码已失效";
                        timerQrcode.Stop();
                    }));
                    break;

                case "1":
                    //二维码未失效
                    break;

                case "2":
                    this.Invoke(new Action(() => {
                        labelTip.Text = "扫码成功,等待用户确定";
                    }));
                    break;

                case "4":
                    this.Invoke(new Action(() => {
                        pictureQRcode.Image.Dispose();
                        pictureQRcode.Image = Properties.Resources.qrcodeInvalid;
                        labelTip.Text       = "没有绑定手机号,请先注册";
                        timerQrcode.Stop();
                    }));
                    break;

                default:
                    //二维码已失效
                    this.Invoke(new Action(() => {
                        pictureQRcode.Image.Dispose();
                        pictureQRcode.Image = Properties.Resources.qrcodeInvalid;
                        labelTip.Text       = "二维码已失效";
                        timerQrcode.Stop();
                    }));
                    break;
                }
            }
            else
            {
                this.Invoke(new Action(() => {
                    pictureQRcode.Image.Dispose();
                    pictureQRcode.Image = Properties.Resources.qrcodeInvalid;
                    labelTip.Text       = "获取二维码失败";
                    timerQrcode.Stop();
                }));
            }
        }
        /// <summary>
        /// 找回密码按钮提交回调函数
        /// </summary>
        /// <param name="state"></param>
        /// <param name="data"></param>
        private void ButtonSubmit_Callback(bool state, byte[] data)
        {
            ClassStatic.Result resultData = ClassStatic.GetResult(data);

            if (resultData != null)
            {
                if (resultData.ret == "true")
                {
                    FormLogin.formLogin.LabelTipShow("修改密码成功,正在跳转...", false);
                    this.Invoke(new Action(() => {
                        labelBackLogin_Click(labelBackLogin, null);
                    }));
                }
                else
                {
                    FormLogin.formLogin.LabelTipShow(resultData.msg);
                }
            }
            else
            {
                FormLogin.formLogin.LabelTipShow("修改密码失败");
            }
        }
示例#5
0
        /// <summary>
        /// 注册账号按钮提交回调函数
        /// </summary>
        /// <param name="state"></param>
        /// <param name="data"></param>
        private void ButtonRegister_Callback(bool state, byte[] data)
        {
            ClassStatic.Result resultData = ClassStatic.GetResult(data);

            if (resultData != null)
            {
                if (resultData.ret == "true")
                {
                    FormLogin.formLogin.LabelTipShow("注册成功,正在跳转", false);
                    this.Invoke(new Action(() => {
                        label5_Click(label5, null);
                    }));
                }
                else
                {
                    FormLogin.formLogin.LabelTipShow(resultData.msg);
                }
            }
            else
            {
                FormLogin.formLogin.LabelTipShow("注册失败");
            }
        }
示例#6
0
        /// <summary>
        /// 找回密码按钮提交回调函数
        /// </summary>
        /// <param name="state"></param>
        /// <param name="data"></param>
        private void ButtonSubmit_Callback(bool state, byte[] data)
        {
            ClassStatic.Result resultData = ClassStatic.GetResult(data);

            this.Invoke(new Action(() => {
                if (resultData != null)
                {
                    if (resultData.ret == "true")
                    {
                        buttonVerify.Enabled = false;
                        buttonSubmit.Enabled = false;
                        LabelTipShow("修改密码成功", false, false);
                    }
                    else
                    {
                        LabelTipShow(resultData.msg);
                    }
                }
                else
                {
                    LabelTipShow("修改密码失败");
                }
            }));
        }
        private void TimerQrcode_Callback(bool state, byte[] data)
        {
            ClassStatic.Result resultData = ClassStatic.GetResult(data);
            if (state && resultData != null)
            {
                switch (resultData.ret)
                {
                case "0":
                    //扫码成功
                    this.Invoke(new Action(() => {
                        labelTip.Text    = "解绑成功";
                        ClassStatic.bind = "";
                        timerQrcode.Stop();
                    }));
                    break;

                case "1":
                    //二维码未失效
                    break;

                case "2":
                    this.Invoke(new Action(() => {
                        labelTip.Text = "扫码成功,等待用户确定";
                    }));
                    break;

                case "4":
                    this.Invoke(new Action(() => {
                        pictureQRcode.Image.Dispose();
                        pictureQRcode.Image = Properties.Resources.qrcodeInvalid;
                        labelTip.Text       = "未绑定到手机号";
                        timerQrcode.Stop();
                    }));
                    break;

                case "5":
                    this.Invoke(new Action(() => {
                        pictureQRcode.Image.Dispose();
                        pictureQRcode.Image = Properties.Resources.qrcodeInvalid;
                        labelTip.Text       = "解绑失败";
                        timerQrcode.Stop();
                    }));
                    break;

                default:
                    //二维码已失效
                    this.Invoke(new Action(() => {
                        pictureQRcode.Image.Dispose();
                        pictureQRcode.Image = Properties.Resources.qrcodeInvalid;
                        labelTip.Text       = "二维码已失效";
                        timerQrcode.Stop();
                    }));
                    break;
                }
            }
            else
            {
                this.Invoke(new Action(() => {
                    pictureQRcode.Image.Dispose();
                    pictureQRcode.Image = Properties.Resources.qrcodeInvalid;
                    labelTip.Text       = "获取二维码失败";
                    timerQrcode.Stop();
                }));
            }
        }