Esempio n. 1
0
        void _kaixinbase_ValidateCodeNeeded(byte[] image, string taskid, string taskname)
        {
            try
            {
                if (this.InvokeRequired)
                {
                    this.Invoke(new KaixinBase.ValidateCodeNeededEventHandler(_kaixinbase_ValidateCodeNeeded), new object[] { image, taskid, taskname });
                }
                else
                {
                    if (!_expanded)
                    {
                        SetControls(true);
                    }
                    else
                    {
                        MessageBox.Show(this, "密码或验证码输入错误,请重试!", Constants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }

                    if (image.Length > 0)
                    {
                        DlgPicValidation dlgPicVal = new DlgPicValidation();
                        dlgPicVal.Email           = txtEmail.Text;
                        dlgPicVal.Password        = txtPassword.Text;
                        dlgPicVal.ValidationImage = image;
                        dlgPicVal.IsRemember      = chkRemember.Checked;
                        dlgPicVal.Location        = this.Location;
                        this.Visible = false;
                        if (dlgPicVal.ShowDialog(this) == DialogResult.OK)
                        {
                            this.Location          = dlgPicVal.Location;
                            this.Visible           = true;
                            txtEmail.Text          = dlgPicVal.Email;
                            txtPassword.Text       = dlgPicVal.Password;
                            txtValidationCode.Text = dlgPicVal.ValidationCode;
                            chkRemember.Checked    = dlgPicVal.IsRemember;
                            if (image.Length > 0)
                            {
                                MemoryStream stream = new MemoryStream();
                                stream.Write(image, 0, image.Length);
                                imgValidationCode.Image = Image.FromStream(stream);
                            }
                            _kaixinbase.ValidationCode = dlgPicVal.ValidationCode;
                        }
                        else
                        {
                            _kaixinbase.ValidationCode = null;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Program.ShowMessageBox("DlgFriendValidation._kaixinbase_ValidateCodeNeeded", ex);
            }
        }
Esempio n. 2
0
        void _kaixinbase_ValidateCodeNeeded(byte[] image, string taskid, string taskname)
        {
            try
            {
                if (this.InvokeRequired)
                {
                    this.Invoke(new KaixinBase.ValidateCodeNeededEventHandler(_kaixinbase_ValidateCodeNeeded), new object[] { image, taskid, taskname });
                }
                else
                {
                    if (!_expanded)
                        SetControls(true);
                    else
                        MessageBox.Show(this, "密码或验证码输入错误,请重试!", Constants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);

                    if (image.Length > 0)
                    {
                        DlgPicValidation dlgPicVal = new DlgPicValidation();
                        dlgPicVal.Email = txtEmail.Text;
                        dlgPicVal.Password = txtPassword.Text;
                        dlgPicVal.ValidationImage = image;
                        dlgPicVal.IsRemember = chkRemember.Checked;
                        dlgPicVal.Location = this.Location;
                        this.Visible = false;
                        if (dlgPicVal.ShowDialog(this) == DialogResult.OK)
                        {
                            this.Location = dlgPicVal.Location;
                            this.Visible = true;
                            txtEmail.Text = dlgPicVal.Email;
                            txtPassword.Text = dlgPicVal.Password;
                            txtValidationCode.Text = dlgPicVal.ValidationCode;
                            chkRemember.Checked = dlgPicVal.IsRemember;
                            if (image.Length > 0)
                            {
                                MemoryStream stream = new MemoryStream();
                                stream.Write(image, 0, image.Length);
                                imgValidationCode.Image = Image.FromStream(stream);
                            }
                            _kaixinbase.ValidationCode = dlgPicVal.ValidationCode;
                        }
                        else
                            _kaixinbase.ValidationCode = null;
                    }
                }
            }
            catch (Exception ex)
            {
                Program.ShowMessageBox("DlgFriendValidation._kaixinbase_ValidateCodeNeeded", ex);
            }
        }