Beispiel #1
0
        //查询
        private void simpleButton2_Click(object sender, EventArgs e)
        {
            string param         = queryParam();
            string paramPageFrom = this.txtFrom.Text;
            string paramPageTo   = this.txtTo.Text;

            try
            {
                this.barBtnItemStart.Enabled = false;
                this.barBtnStop.Enabled      = true;
                this.label2.Invoke(new Action(() =>
                {
                    this.label2.Text = string.Format("{0} 开始抓取机动车合格证申请数据  ", DateTime.Now.ToString("G"));
                }));

                hgzUtils = new HGZUtils("HGZ", this.gridControl2, this.label2);
                hgzUtils.StartThreadPool(param, paramPageFrom, paramPageTo);
                //hgzUtilsPool = new HGZUtilsThreadPool("HGZ", this.gridControl1, this.CrawlerLog);
                //hgzUtilsPool.StartThreadPool(param, paramPageFrom, paramPageTo);
            }
            catch (Exception ex)
            {
                MessageBox.Show("抓取开始异常:" + ex.Message, "异常", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 导入ID列表的TXT文件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void barBtnReadPAGE_ItemClick(object sender, ItemClickEventArgs e)
        {
            OpenFileDialog file = new OpenFileDialog();

            file.ShowDialog();
            string        fileName = file.FileName;
            StringBuilder sbID     = new StringBuilder();
            StreamReader  sr       = new StreamReader(fileName, Encoding.Default);
            String        line;
            bool          isNull = true;

            while ((line = sr.ReadLine()) != null)
            {
                if (!string.IsNullOrEmpty(line))
                {
                    sbID.Append(",");
                    sbID.Append(line.ToString().Trim());
                    isNull = false;
                }
            }
            if (isNull)//如果文件内容为空
            {
                MessageBox.Show("文件为空。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            try
            {
                this.barBtnItemStart.Enabled = false;
                this.barBtnStop.Enabled      = true;

                this.CrawlerLog.Invoke(new Action(() =>
                {
                    this.CrawlerLog.Items.Add(string.Format("{0} 开始抓取机动车合格证申请数据  ", DateTime.Now.ToString("G")));
                }));
                this.CrawlerLog.SelectedIndex = 0;

                hgzUtils = new HGZUtils("HGZ", this.gridControl1, this.CrawlerLog);
                hgzUtils.Start(sbID.ToString().Substring(1));
            }
            catch (Exception ex)
            {
                MessageBox.Show("抓取开始异常:" + ex.Message, "异常", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Beispiel #3
0
 private void AllForm_Load(object sender, EventArgs e)
 {
     //填充待抓取的数据资源名称
     //DataTable dtName = new DataTable();
     //dtName.Columns.Add("check", System.Type.GetType("System.Boolean"));
     //dtName.Columns["check"].ReadOnly = false;
     //dtName.Columns.Add("name", System.Type.GetType("System.String"));
     //for (int i = 0; i < tableNames.Length; i++)
     //{
     //    dtName.Rows.Add(false, tableNames[i]);
     //}
     //this.gcName.DataSource = dtName;
     hgzUtils           = new HGZUtils("HGZ", null, this.CrawlerLog);
     pzUtils            = new PZUtils("PZ", null, this.CrawlerLog);
     wsUtils            = new WSUtils("WS", null, this.CrawlerLog);
     hgzUtilsPool       = new HGZUtilsThreadPool("HGZ", null, this.CrawlerLog);
     this.txtTime.Text  = Settings.Default.RunT;
     this.txtTime.Text  = Settings.Default.RunMinute;
     this.dtStart1.Text = DateTime.Now.Date.AddDays(-1).ToString();
 }
Beispiel #4
0
 private void HGZForm_Load(object sender, EventArgs e)
 {
     hgzUtils     = new HGZUtils("HGZ", this.gridControl1, this.CrawlerLog);
     hgzUtilsPool = new HGZUtilsThreadPool("HGZ", this.gridControl1, this.CrawlerLog);
 }