Ejemplo n.º 1
0
        private void FormLoadInit()
        {
            GetCookies   newcookie = new GetCookies();
            DialogResult result;

            if (newcookie.Getstatus() != "OK")
            {
                result = MessageBox.Show("无法请求Cookies,请检查网络状态后再试!\r\n选择“中止”退出程序\r\n选择“重试”尝试重新请求\r\n选择“忽略”进入离线读取模式", "初始化失败", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Error);
                if (result == DialogResult.Abort)
                {
                    System.Environment.Exit(0);
                }
                else if (result == DialogResult.Retry)
                {
                    FormLoadInit();
                    return;
                }
                else
                {
                    return;
                }
                //System.Environment.Exit(0);
            }
            GetViewCode newviewcode = new GetViewCode();

            if (newviewcode.GetStatus() != "OK")
            {
                result = MessageBox.Show("无法加载验证码图片,请检查网络状态后再试!\r\n选择“中止”退出程序\r\n选择“重试”尝试重新请求\r\n选择“忽略”进入离线读取模式", "初始化失败", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Error);
                if (result == DialogResult.Abort)
                {
                    System.Environment.Exit(0);
                }
                else if (result == DialogResult.Retry)
                {
                    FormLoadInit();
                    return;
                }
                else
                {
                    return;
                }
                //System.Environment.Exit(0);
            }
            CodeView.Image = newviewcode.GetPic();
        }
Ejemplo n.º 2
0
        private void RequestCode()
        {
            GetCookies CodeCookie = new GetCookies();

            if (CodeCookie.Getstatus() != "OK")
            {
                MessageBox.Show("Cookie请求失败,请检查网络状态后再试!", "请求失败", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            GetViewCode CodePic = new GetViewCode();

            if (CodePic.GetStatus() != "OK")
            {
                MessageBox.Show("验证码请求失败,请检查网络状态后再试!", "请求失败", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            CodeView.Image = CodePic.GetPic();
        }