Example #1
0
 private void Button_Setting_Click(object sender, EventArgs e)
 {
     try
     {
         if (!RegexHelper.IsNumber(this.textBox_ThreadCount.Text))
         {
             MessageBox.Show("线程最大数必须输入整数!", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
             return;
         }
         if (!RegexHelper.IsNumber(this.textBox_BaiduPage.Text))
         {
             MessageBox.Show("百度最大页数必须输入整数!", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
             return;
         }
         SettingInfo info = SettingConfig.GetConfig();
         info.ThreadCount = int.Parse(this.textBox_ThreadCount.Text);
         info.BaiduPage   = int.Parse(this.textBox_BaiduPage.Text);
         SettingConfig.SaveConfig(info);
         MessageBox.Show("设置成功", "操作提示");
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Example #2
0
        private void Setting_Load(object sender, EventArgs e)
        {
            SettingInfo info = new SettingInfo();

            info = SettingConfig.GetConfig();
            this.textBox_ThreadCount.Text = info.ThreadCount.ToString();
            this.textBox_BaiduPage.Text   = info.BaiduPage.ToString();
        }
Example #3
0
        /// <summary>
        /// 开始
        /// </summary>
        public void Start()
        {
            string[]    searchLink = LinkHelper.CreateBaiduSearchLink(wd);
            SettingInfo info       = SettingConfig.GetConfig();

            Linker = new Linker(info.ThreadCount);
            //注册状态改变事件
            Linker.LinkerCallbacked += new LinkerCallbacked(LinkerCallbacked);
            Linker.InitSeeds(searchLink);
            Linker.Start();
        }