private void webBrowser1_DocumentCompleted_1(object sender, WebBrowserDocumentCompletedEventArgs e)
{
try
{
if (this.webBrowser1.ReadyState != WebBrowserReadyState.Complete)
Application.DoEvents();
else if (e.Url.ToString() != this.webBrowser1.Url.ToString())
{
Application.DoEvents();
}
else
{
string str1 = this.webBrowser1.Url.ToString();
if (str1.IndexOf("&catid=0") > 0 || str1.IndexOf("fktz.php") != -1)
{
if (this._cur_home_url.Trim() != "")
{
this.webBrowser1.Navigate(this._cur_home_url);
this.lastCheckClick = DateTime.Now.AddSeconds(30.0);
return;
}
}
else
this.postTask(0);
this._clickedUrl += this.webBrowser1.Url.ToString();
this.isLoad = true;
if (this._curTask.Stu == "搜索宝贝")
{
if (this._curTask.comeType == "按京东")
{
this.lastCheckClick = DateTime.Now.AddSeconds(17.0);
this._curTask.startTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
}
else if (this._curTask.comeType == "阿里巴巴")
{
this.lastCheckClick = DateTime.Now.AddSeconds(35.0);
this._curTask.startTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
}
else
{
this.lastCheckClick = DateTime.Now.AddSeconds(15.0);
this._curTask.startTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
}
}
else if (this._curTask.Stu == "按类目搜索宝贝")
{
this.lastCheckClick = DateTime.Now.AddSeconds(10.0);
// ISSUE: explicit reference operation
// ISSUE: variable of a reference type
TaskTBSturct local1 = this._curTask;
DateTime now = DateTime.Now;
string str2 = now.ToString("yyyy-MM-dd HH:mm:ss");
// ISSUE: explicit reference operation
(local1).startTime = str2;
string innerHtml = this.webBrowser1.Document.GetElementById("J_CatBd").InnerHtml;
HtmlElementCollection elementsByTagName = this.webBrowser1.Document.GetElementById("J_CatBd").Document.GetElementsByTagName("LI");
for (int index = 0; index < elementsByTagName.Count; ++index)
{
string outerHtml = elementsByTagName[index].OuterHtml;
if (outerHtml != null && outerHtml.IndexOf(this._curTask.lm1.Trim()) > 0)
{
elementsByTagName[index].InvokeMember("Click");
this._curTask.Stu = "搜索宝贝";
now = DateTime.Now;
this.lastCheckClick = now.AddSeconds(50.0);
// ISSUE: explicit reference operation
// ISSUE: variable of a reference type
TaskTBSturct local2 = this._curTask;
now = DateTime.Now;
string str3 = now.ToString("yyyy-MM-dd HH:mm:ss");
// ISSUE: explicit reference operation
(local2).startTime = str3;
break;
}
}
}
else if (this._curTask.Stu == "搜索类目宝贝")
{
HtmlElementCollection elementsByTagName1 = this.webBrowser1.Document.GetElementsByTagName("INPUT");
for (int index = 0; index < elementsByTagName1.Count; ++index)
{
string outerHtml = elementsByTagName1[index].OuterHtml;
if (outerHtml != null && outerHtml.IndexOf("search-keyword") > 0)
{
elementsByTagName1[index].SetAttribute("value", this._curTask.keyword);
break;
}
}
HtmlElementCollection elementsByTagName2 = this.webBrowser1.Document.GetElementsByTagName("A");
for (int index = 0; index < elementsByTagName2.Count; ++index)
{
string outerHtml = elementsByTagName2[index].OuterHtml;
if (outerHtml != null && outerHtml.IndexOf("搜全站") > 0)
{
elementsByTagName2[index - 1].InvokeMember("Click");
this._curTask.Stu = "搜索宝贝";
DateTime now = DateTime.Now;
this.lastCheckClick = now.AddSeconds(50.0);
// ISSUE: explicit reference operation
// ISSUE: variable of a reference type
TaskTBSturct local = this._curTask;
now = DateTime.Now;
string str2 = now.ToString("yyyy-MM-dd HH:mm:ss");
// ISSUE: explicit reference operation
(local).startTime = str2;
break;
}
}
}
else if (this._curTask.Stu == "浏览进店页" && this._cur_home_url.Trim() == "")
{
HtmlDocument document = this.webBrowser1.Document;
this.webBrowser1.Document.GetElementsByTagName("a");
for (int index = 0; index < document.Links.Count; ++index)
{
string outerHtml = document.Links[index].OuterHtml;
string innerText = document.Links[index].InnerText;
if (innerText != null && innerText.IndexOf("进入店铺") != -1)
{
string[] strArray = sys.rValue(outerHtml, "href=\"", "\"");
if (strArray.Length > 0)
{
this._cur_home_url = strArray[0].Trim();
break;
}
}
}
}
}
}
catch
{
}
}