//开始自动抓取 private void WS_Start() { try { this.CrawlerLog.Invoke(new Action(() => { this.CrawlerLog.Items.Add(string.Format("{0} 开始抓取完税信息 ", DateTime.Now.ToString("G"))); })); wsUtils = new WSUtils("WS", null, this.CrawlerLog); wsUtils.Start(queryParam("WS"), "1", ""); } catch (Exception ex) { MessageBox.Show("抓取完税信息开始异常:" + ex.Message, "异常", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
//开始自动抓取 private void barBtnItemStart_ItemClick(object sender, ItemClickEventArgs e) { try { this.barBtnItemStart.Enabled = false; this.barBtnStop.Enabled = true; this.Invoke(new Action(() => { this.CrawlerLog.Items.Add(string.Format("{0} 开始抓取完税信息 ", DateTime.Now.ToString("G"))); })); this.CrawlerLog.SelectedIndex = 0; wsUtils.Start("", "1", ""); } catch (Exception ex) { MessageBox.Show("抓取完税信息开始异常:" + ex.Message, "异常", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
//查询 private void simpleButton2_Click(object sender, EventArgs e) { wsUtils = new WSUtils("WS", this.gridControl2, this.label2); string param = queryParam(); try { this.barBtnItemStart.Enabled = false; this.barBtnStop.Enabled = true; //this.CrawlerLog.Items.Add(string.Format("{0} 开始抓取完税信息 ", DateTime.Now.ToString("G"))); this.label2.Invoke(new Action(() => { this.label2.Text = string.Format("{0} 开始抓取完税信息 ", DateTime.Now.ToString("G")); })); wsUtils.Start(param, this.txtFrom.Text, this.txtTo.Text); } catch (Exception ex) { MessageBox.Show("抓取完税信息开始异常:" + ex.Message, "异常", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }