Пример #1
0
        private void refresh(Object o)
        {
            disableView();
            Object[] login   = (Object[])o;
            bool     showMsg = (login.Length == 3) ? (bool)login[2] : true;
            String   html    = null;
            WebProxy proxy   = XMLConfig.GetProxy();

            try
            {
                html = ScoreHTMLUtil.TryGetHTMLString((String)login[0], (String)login[1], "9999", proxy, IsNormal);
                if (string.IsNullOrEmpty(html))
                {
                    throwError("无法抓取成绩信息,可能是服务器正忙或者是网络连接出错。", "网络错误", showMsg);
                }
                if (html.Contains("Course.jsp"))
                {
                    throwError("由于使用错误密码请求多次,请求被URP拒绝。\n请用浏览器重新登录URP输入正确的验证码后再使用本工具", "URP登录错误", showMsg);
                }
                else if (html.Contains("复旦大学统一身份认证服务"))
                {
                    throwError("学号密码不正确", "URP登录错误", showMsg);
                }
                List <Lesson> lessons = ParseHTML.TryParseHTML(html, GpaInfo, IsNormal);
                if (lessons == null)
                {
                    throwError("抓取的网页无法解析", "解析数据错误", showMsg);
                }
                refreshListView(lessons);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message, e.HelpLink);
            }
            enableView();
        }