static void LoginAccountFormBackground(Object loginArgu)
        {
            //AccountInfo logArgu = (AccountInfo)loginArgu;
            String cUsername = (loginArgu as LoginThreadManager).userName;
            String cPassword = (loginArgu as LoginThreadManager).passWord;
            WeiboAccountLogin processLogin = null;
            String result = "";
            try
            {
                processLogin = new WeiboAccountLogin(cUsername, cPassword, false);
                Image pinImage = processLogin.Start();
                if (pinImage != null)
                {
                    Form formPIN = new WeiboLoginPIN(processLogin, pinImage);
                    if (formPIN.ShowDialog() == DialogResult.OK)
                    {

                        result = processLogin.End((string)formPIN.Tag);
                        //string html = processLogin.Get("http://weibo.com/5237923337/",null);
                        //SetText(txtOutput, html);
                    }
                    else
                    {
                        result = "用户没有输入验证码,请重新登陆";
                    }
                }
                else
                {
                    result = processLogin.End(null);

                    //string html = processLogin.Get("http://weibo.com/5237923337/");
                    //SetText(txtOutput, html);
                }
            }
            catch (Exception ex)
            {
                result = ex.Message;
            }

            //对登陆结果进行判断并处理

            if (result == "0")
            {
                //MessageBox.Show("登陆成功!");
                AccountManager tmpValue = new AccountManager(processLogin, true);
                (loginArgu as LoginThreadManager).mControlAllAccounts.Add(tmpValue);
                String showInfo = "微博账号" + tmpValue.accountLoginRef.Username + "登录成功!";
                (loginArgu as LoginThreadManager).dShowStatusLoginAccounts.Invoke(showInfo);   //触发 回调
            }
            else if (result == "2070")
            {
                //MessageBox.Show("验证码错误,请重新登陆", "提示");
                String showInfo = "微博账号" + processLogin.Username + "验证码错误,请重新登陆!";
                (loginArgu as LoginThreadManager).dShowStatusLoginAccounts.Invoke(showInfo);   //触发 回调
            }
            else if (result == "101&")
            {
                //MessageBox.Show("密码错误,请重新登陆", "提示");
                String showInfo = "微博账号" + processLogin.Username + "密码错误,请重新登陆!";
                (loginArgu as LoginThreadManager).dShowStatusLoginAccounts.Invoke(showInfo);   //触发 回调
            }
            else if (result == "4049")
            {
                //MessageBox.Show("验证码为空,请重新登陆(如果你没有输入验证码,请选中强制验证码进行登录)", "提示");
                String showInfo = "微博账号" + processLogin.Username + "验证码为空,请重新登陆(如果你没有输入验证码,请选中强制验证码进行登录)!";
                (loginArgu as LoginThreadManager).dShowStatusLoginAccounts.Invoke(showInfo);   //触发 回调
            }
            else
            {
                MessageBox.Show(result, "提示");
            }
        }
Exemple #2
0
 public WeiboLoginPIN(WeiboAccountLogin wb, Image pinImage)
 {
     InitializeComponent();
     picPIN.Image = pinImage;
     this.processLogin = wb;
 }
Exemple #3
0
 public AccountManager(WeiboAccountLogin wb, Boolean ht)
 {
     this.accountLoginRef = wb;
     this.hasTaken = ht;
 }