public bool SysWait(TaskForm parent) { TimeSpan span = (TimeSpan) (this._now - this._beforeWaitTime); double totalSeconds = span.TotalSeconds; if (totalSeconds >= TaskForm.SYSTEMWAITTIME) { this._beforeWaitTime = this._now; this._status = IEStatus.IEStatus_None; return true; } parent.ShowTip4("等待网页加载" + totalSeconds.ToString()); return false; }
public bool Update(TaskForm parent) { bool flag = false; this._now = DateTime.Now; TimeSpan span = (TimeSpan) (this._now - this._startTaskTime); if (span.TotalMinutes > 20.0) { this._errorString = "任务超时"; this._threadRun = false; } if (this._threadRun) { try { if (this._status == IEStatus.IEStatus_SysWait) { flag = this.SysWait(parent); } else if (this._status == IEStatus.IEStatus_SysComplete) { flag = this.SysWaitForComplete(); } else if (this._curWebBrowser != null) { flag = this.ParseItems(parent); } } catch (Exception exception) { flag = true; Logger.Error(exception); } if (this._errorString != string.Empty) { this._threadRun = false; } if (flag) { this.ResetTaskTime(); this._inputClickTaobaoCloseButton = false; this._randomClickLinkCount = 0; this._status = IEStatus.IEStatus_None; if (this._threadRun && (this._task.GetTaskInfo(ref this._taskInfo, ref this._taskInfoIndex, ref this._startLoop, ref this._loop, ref this._loopTime) != 0)) { if (!this._isCompleted) { this._isCompleted = true; this._status = IEStatus.IEStatus_SysComplete; } else { this._threadRun = false; } } } this.CheckDocCompletTimeOut(); } if (!this._threadRun) { parent.ShowTip2("任务结束"); parent.ShowTip3(""); parent.ShowTip4(""); return true; } return false; }
private bool ParseItems(TaskForm parent) { bool isClick = false; bool isFind = false; int clickLinkCount = 0; this.ResetMouseControl(); if (this._isDocCompleted) { TimeSpan span = (TimeSpan) (this._now - this._waitFindTime); parent.ShowTip4("完成:" + span.TotalSeconds.ToString()); } else { TimeSpan span2 = (TimeSpan) (this._now - this._waitDocTime); parent.ShowTip4("等待:" + span2.TotalSeconds.ToString()); } TaskCommand command = TaskCommand.Task_None; if ((this._taskInfo._param1 != null) && (this._taskInfo._param1 != "")) { command = (TaskCommand) WindowUtil.StringToInt(this._taskInfo._param1); } switch (command) { case TaskCommand.Task_Wait: return this.Wait(parent, int.Parse(this._taskInfo._param2)); case TaskCommand.Task_InputText: return this.InputText(parent, this._taskInfo._param2, this._taskInfo._param3, this._taskInfo._param4, this._taskInfo._param5); case TaskCommand.Task_ClickButton: return this.ClickButton(parent, this._taskInfo._param2, this._taskInfo._param3, this._taskInfo._param4, ref isClick); case TaskCommand.Task_ClickLink: return this.ClickLink(parent, this._taskInfo._param2, this._taskInfo._param3, this._taskInfo._param4, this._taskInfo._param5, ref isFind, ref isClick, true, false, ref clickLinkCount); case TaskCommand.Task_Navigate: return this.Navigate(parent, this._taskInfo._param2, this._taskInfo._param3); case TaskCommand.Task_DeepClick: return this.DeepClick(parent, this._taskInfo._param2, this._taskInfo._param3, this._taskInfo._param4); case TaskCommand.Task_ClearCookie: return this.ClearCookie(parent, this._taskInfo._param2); case TaskCommand.Task_FindLinkLinkPage1: case TaskCommand.Task_FindLinkHrefPage1: case TaskCommand.Task_FindHrefLinkPage1: case TaskCommand.Task_FindHrefHrefPage1: case TaskCommand.Task_FindLinkSrcPage1: case TaskCommand.Task_FindHrefSrcPage1: case TaskCommand.Task_FindSrcLinkPage1: case TaskCommand.Task_FindSrcHrefPage1: case TaskCommand.Task_FindSrcSrcPage1: return this.FindPage(parent, command, this._taskInfo._param2, this._taskInfo._param3, this._taskInfo._param4, this._taskInfo._param5); case TaskCommand.Task_Fresh: return this.Fresh(parent); case TaskCommand.Task_PressKey: return this.PressKey(parent); case TaskCommand.Task_ClickRadio: return this.ClickRadio(parent, this._taskInfo._param2, this._taskInfo._param3, this._taskInfo._param4, ref isClick); case TaskCommand.Task_ClickChecked: return this.ClickChecked(parent, this._taskInfo._param2, this._taskInfo._param3, this._taskInfo._param4, ref isClick); } parent.ShowTip2("线程未知参数 " + this._taskInfo._param1); this._errorString = this._errorString + "线程未知参数 " + this._taskInfo._param1; return true; }