大概的代码意思如下:开始就设断点吧 他只会在 timer1中循环 UI界面都显示不出来!!运行到指定页面再在timer1处设断点吧,她又不停!!
string tempurl;
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
tempurl = webBrowser1.Url.ToString() + " 刚进入";
txtUrl.Text = tempurl;
......................
......................
tempurl = webBrowser1.Url.ToString() + " 你好";
txtUrl.Text = tempurl;
}
..................
private void timer1_Tick(object sender, EventArgs e)
{
string myurl = tempurl;
if (myurl.Contains("你好"))
{
txtUrl.Text = "已进入感兴趣的页面";
MessageBox.Show("timer检查到的日志页面");//即使用MessageBox.Show 也没效果!
}
}
string tempurl;
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
tempurl = webBrowser1.Url.ToString() + " 刚进入";
txtUrl.Text = tempurl;
......................
......................
tempurl = webBrowser1.Url.ToString() + " 你好";
txtUrl.Text = tempurl;
}
..................
private void timer1_Tick(object sender, EventArgs e)
{
string myurl = tempurl;
if (myurl.Contains("你好"))
{
txtUrl.Text = "已进入感兴趣的页面";
MessageBox.Show("timer检查到的日志页面");//即使用MessageBox.Show 也没效果!
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货