修改重试次数 添加搜索引擎的选择...

master
j502647092 2015-08-04 16:29:16 +08:00
parent 88d6b67f12
commit 357bb468e7
2 changed files with 72 additions and 8 deletions

54
Frm_Main.Designer.cs generated
View File

@ -62,6 +62,9 @@
this.clearsearch = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label();
this.retry = new System.Windows.Forms.TextBox();
this.baiducheck = new System.Windows.Forms.CheckBox();
this.bingcheck = new System.Windows.Forms.CheckBox();
this.sougoucheck = new System.Windows.Forms.CheckBox();
((System.ComponentModel.ISupportInitialize)(this.SearchView)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.ResultView)).BeginInit();
this.SuspendLayout();
@ -193,7 +196,7 @@
//
// max
//
this.max.Location = new System.Drawing.Point(663, 4);
this.max.Location = new System.Drawing.Point(777, 4);
this.max.Name = "max";
this.max.Size = new System.Drawing.Size(83, 21);
this.max.TabIndex = 3;
@ -202,7 +205,7 @@
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(592, 7);
this.label1.Location = new System.Drawing.Point(706, 7);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(65, 12);
this.label1.TabIndex = 7;
@ -268,7 +271,7 @@
//
this.label2.AutoSize = true;
this.label2.BackColor = System.Drawing.SystemColors.ControlLight;
this.label2.Location = new System.Drawing.Point(592, 34);
this.label2.Location = new System.Drawing.Point(706, 34);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(65, 12);
this.label2.TabIndex = 14;
@ -276,16 +279,54 @@
//
// retry
//
this.retry.Location = new System.Drawing.Point(663, 31);
this.retry.Location = new System.Drawing.Point(777, 31);
this.retry.Name = "retry";
this.retry.Size = new System.Drawing.Size(83, 21);
this.retry.TabIndex = 13;
this.retry.Text = "3";
this.retry.Text = "5";
//
// baiducheck
//
this.baiducheck.AutoSize = true;
this.baiducheck.Checked = true;
this.baiducheck.CheckState = System.Windows.Forms.CheckState.Checked;
this.baiducheck.Location = new System.Drawing.Point(534, 12);
this.baiducheck.Name = "baiducheck";
this.baiducheck.Size = new System.Drawing.Size(48, 16);
this.baiducheck.TabIndex = 15;
this.baiducheck.Text = "百度";
this.baiducheck.UseVisualStyleBackColor = true;
this.baiducheck.CheckedChanged += new System.EventHandler(this.check_CheckedChanged);
//
// bingcheck
//
this.bingcheck.AutoSize = true;
this.bingcheck.Location = new System.Drawing.Point(534, 36);
this.bingcheck.Name = "bingcheck";
this.bingcheck.Size = new System.Drawing.Size(48, 16);
this.bingcheck.TabIndex = 16;
this.bingcheck.Text = "必应";
this.bingcheck.UseVisualStyleBackColor = true;
this.bingcheck.CheckedChanged += new System.EventHandler(this.check_CheckedChanged);
//
// sougoucheck
//
this.sougoucheck.AutoSize = true;
this.sougoucheck.Location = new System.Drawing.Point(600, 36);
this.sougoucheck.Name = "sougoucheck";
this.sougoucheck.Size = new System.Drawing.Size(48, 16);
this.sougoucheck.TabIndex = 17;
this.sougoucheck.Text = "搜狗";
this.sougoucheck.UseVisualStyleBackColor = true;
this.sougoucheck.CheckedChanged += new System.EventHandler(this.check_CheckedChanged);
//
// Frm_Main
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.ClientSize = new System.Drawing.Size(872, 603);
this.Controls.Add(this.sougoucheck);
this.Controls.Add(this.bingcheck);
this.Controls.Add(this.baiducheck);
this.Controls.Add(this.label2);
this.Controls.Add(this.retry);
this.Controls.Add(this.clearsearch);
@ -339,6 +380,9 @@
private System.Windows.Forms.DataGridViewTextBoxColumn sum;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox retry;
private System.Windows.Forms.CheckBox baiducheck;
private System.Windows.Forms.CheckBox bingcheck;
private System.Windows.Forms.CheckBox sougoucheck;
}
}

View File

@ -15,6 +15,7 @@ namespace SEOKeywordSearch
{
public partial class Frm_Main : Form
{
List<string> searchen = new List<string> { "百度" };
public Frm_Main()
{
InitializeComponent();
@ -72,6 +73,11 @@ namespace SEOKeywordSearch
private void search_Click(object sender, EventArgs e)
{
if (searchen.Count == 0)
{
MessageBox.Show("请选择启用的搜索引擎!");
return;
}
search.Enabled = false;
state.ForeColor = Color.Black;
state.ForeColor = Color.Red;
@ -97,6 +103,8 @@ namespace SEOKeywordSearch
string pageinfo = string.Empty;
foreach (SearchType s in Enum.GetValues(typeof(SearchType)))
{
if (!searchen.Contains(s.ToString()))
continue;
if (item.Cells[s.ToString() + "s"].Value == null)
item.Cells[s.ToString() + "s"].Value = 0;
state.ForeColor = Color.Black;
@ -177,9 +185,12 @@ namespace SEOKeywordSearch
item.Cells["sum"].Value = 0;
foreach (SearchType s in Enum.GetValues(typeof(SearchType)))
{
int all = int.Parse(item.Cells["sum"].Value.ToString());
int add = int.Parse(item.Cells[s.ToString() + "s"].Value.ToString());
item.Cells["sum"].Value = all + add;
if (searchen.Contains(s.ToString()))
{
int all = int.Parse(item.Cells["sum"].Value.ToString());
int add = int.Parse(item.Cells[s.ToString() + "s"].Value.ToString());
item.Cells["sum"].Value = all + add;
}
}
}
Application.DoEvents();
@ -255,5 +266,14 @@ namespace SEOKeywordSearch
SearchView.Rows.Clear();
}
#endregion
private void check_CheckedChanged(object sender, EventArgs e)
{
CheckBox check = (CheckBox)sender;
if (check.Checked)
searchen.Add(check.Text);
else
searchen.Remove(check.Text);
}
}
}