private void btnStart_Click(object sender, EventArgs e)
{
if (tbxClasse.Text.Length != 6)
{
MessageBox.Show("请输入正确的学号前缀!", "滑稽");
return;
}
if (tbxMaxID.Text.Length != 2)
{
MessageBox.Show("请输入正确的最大学号!", "滑稽");
return;
}
int start = 1, end = int.Parse(tbxMaxID.Text);
string courseID = tbxCourse.Text;
string tableContent = "<head id=\"Head1\"><title>教务管理信息系统</title><link href=\"http://219.230.159.132/css/oa_Mview.css\" rel=\"stylesheet\" type=\"text/css\"><link href=\"../css/css-table.css\" rel=\"stylesheet\" type=\"text/css\"><link href=\"http://219.230.159.132/css/ASPNET2BaseCss.css\" rel=\"stylesheet\" type=\"text/css\"><style type=\"text/css\"> .GVFixedHeader { font-weight:bold; color: #A80000; position:relative; top:expression(this.parentNode.parentNode.parentNode.scrollTop-1);}.GVFixedFooter { font-weight:bold; position:relative;bottom:expression(getScrollBottom(this.parentNode.parentNode.parentNode.parentNode));}.Freezing{background-color:#FF8000;position:relative ;table-layout:fixed;top:expression(this.offsetParent.scrollTop); z-index: 10;} .Freezing th{text-overflow:ellipsis;overflow:hidden;white-space: nowrap;padding:2px;}</style></head><table class=\"dg1-table\" cellspacing=\"0\" rules=\"all\" border=\"1\" id=\"gvcj1\" width=\"98%\" style=\"left: 2px; top: 31px\"><tr class=\"dg1-item\">";
progressBar1.Minimum = start;
progressBar1.Maximum = end;
progressBar1.Value = 1;
progressBar1.Step = 1;
progressBar1.Visible = true;
for (int i = start; i <= end; i++)
{
string url = string.Format("http://219.230.159.132/web_cjgl/cx_cj_xh_gly.aspx?whfs=%E5%AD%A6%E7%94%9F%E5%88%97%E8%A1%A8%E6%88%90%E7%BB%A9&xsxh={0}{1:d2}&xsbh=&kcdm", tbxClasse.Text, i);
string content = getPage(url);
string[] lines = content.Split('\n');
for (int index = 0; index < lines.Length; index++)
{
if (lines[index].Contains(courseID.Trim()))
{
tableContent += lines[index];
tableContent += "</tr><tr class=\"dg1 - item\">";
break;
}
}
progressBar1.PerformStep();
}
tableContent += "</table>";
WebView wv = new WebView();
wv.Content = tableContent;
wv.ShowDialog();
}