/// <summary> /// 开始 /// </summary> private void Start(object sender) { string timeTick = DateTime.Now.ToLongDateString() + " " + DateTime.Now.ToLongTimeString(); if (this.Action == Config.Action.Running) { this.AppendLog(string.Format("{0} 任务正在运行中,启动任务失败...", timeTick)); return; } this.AppendLog(string.Format("{0} 开始任务", timeTick)); /* * 设定任务开始时间和状态 */ this._TaskConfig.StartingTime = DateTime.Now; this.Action = Config.Action.Running; #region 构造采集结果数据表结构 this._Results = new DataTable(); foreach (ExtractionRule rule in this._TaskConfig.ExtractionRules) { DataColumn colume = new DataColumn(); colume.DataType = typeof(string); colume.ColumnName = rule.Name; colume.Caption = rule.DataColumn; //colume.Unique = rule.DataUnique; this._Results.Columns.Add(colume); } #endregion /* * 功能: * 以下代码完成解析导航地址功能。 * * 步骤: * 1.根据UrlListManager配置创建ParseNavigationRules导航地址解析对象. * 2.注册一个每增加导航地址时相应的事件. * 3.Exec开始解析导航地址. * * 修改标志:王亚 20120424 */ ParseNavigationRules parseNav = new ParseNavigationRules(this._TaskConfig.UrlListManager); parseNav.onSingleComplete += new onSingleComplete(parseNav_onSingleComplete); parseNav.OnAppendSingileLog += new Config.OnAppendSingileLog(parseNav_OnAppendSingileLog); parseNav.Exec(); //设置任务状态为完成 this.Action = Config.Action.Finish; }