This commit is contained in:
2014-10-06 09:56:39 +00:00
parent ea86488e44
commit 1fac360745
2 changed files with 67 additions and 13 deletions

18
Form1.Designer.cs generated
View File

@@ -29,25 +29,34 @@
private void InitializeComponent() private void InitializeComponent()
{ {
this.Process = new System.Windows.Forms.CheckBox(); this.Process = new System.Windows.Forms.CheckBox();
this.tbURL = new System.Windows.Forms.TextBox();
this.SuspendLayout(); this.SuspendLayout();
// //
// Process // Process
// //
this.Process.Appearance = System.Windows.Forms.Appearance.Button; this.Process.Appearance = System.Windows.Forms.Appearance.Button;
this.Process.AutoSize = true; this.Process.Location = new System.Drawing.Point(104, 65);
this.Process.Location = new System.Drawing.Point(90, 61);
this.Process.Name = "Process"; this.Process.Name = "Process";
this.Process.Size = new System.Drawing.Size(62, 22); this.Process.Size = new System.Drawing.Size(139, 77);
this.Process.TabIndex = 0; this.Process.TabIndex = 0;
this.Process.Text = "Process"; this.Process.Text = "Process";
this.Process.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.Process.UseVisualStyleBackColor = true; this.Process.UseVisualStyleBackColor = true;
this.Process.CheckedChanged += new System.EventHandler(this.Process_CheckedChanged); this.Process.CheckedChanged += new System.EventHandler(this.Process_CheckedChanged);
// //
// tbURL
//
this.tbURL.Location = new System.Drawing.Point(12, 12);
this.tbURL.Name = "tbURL";
this.tbURL.Size = new System.Drawing.Size(343, 21);
this.tbURL.TabIndex = 1;
//
// Form1 // Form1
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(284, 262); this.ClientSize = new System.Drawing.Size(367, 212);
this.Controls.Add(this.tbURL);
this.Controls.Add(this.Process); this.Controls.Add(this.Process);
this.Name = "Form1"; this.Name = "Form1";
this.Text = "Form1"; this.Text = "Form1";
@@ -59,6 +68,7 @@
#endregion #endregion
private System.Windows.Forms.CheckBox Process; private System.Windows.Forms.CheckBox Process;
private System.Windows.Forms.TextBox tbURL;
} }
} }

View File

@@ -14,11 +14,14 @@ namespace WebChecker
WebBrowser wb = new WebBrowser(); WebBrowser wb = new WebBrowser();
string url = "http://me.sayclub.com/profile/home/view/ban8"; string url = "http://me.sayclub.com/profile/home/view/ban8";
Timer m_Timer = new Timer(); Timer m_Timer = new Timer();
bool m_bProcessing = false;
public Form1() public Form1()
{ {
InitializeComponent(); InitializeComponent();
tbURL.Text = url;
m_Timer.Interval = 5000; m_Timer.Interval = 5000;
m_Timer.Tick += new EventHandler(m_Timer_Tick); m_Timer.Tick += new EventHandler(m_Timer_Tick);
@@ -28,31 +31,72 @@ namespace WebChecker
void wb_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) void wb_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{ {
HtmlDocument doc = wb.Document; HtmlDocument doc = wb.Document;
HtmlElement element = doc.GetElementById("sbVisitedUser");
string strCnt = (string)element.InnerText.Clone();
strCnt = strCnt.Substring(0, strCnt.IndexOf("명")); HtmlElement element = doc.GetElementById("sbPersonalInfo");
strCnt = strCnt.Substring(strCnt.IndexOf("오늘")+"오늘".Length); element = element.Children[element.Children.Count-1];
strCnt = strCnt.Trim(); element = element.Children[0];
element = element.GetElementsByTagName("IMG")[0];
int iCnt = Convert.ToInt32(strCnt); string attr = element.GetAttribute("src");
if(iCnt > 3) if(attr.IndexOf("login") >= 0)
MessageBox.Show(iCnt + "명 : 확인해바라"); {
Process.Checked = false;
MessageBox.Show("loged in");
}
m_bProcessing = false;
//string strStatus = element.InnerText;
//string[] strList = strStatus.Split(':');
//strStatus = strList[1];
//strStatus = strStatus.Trim();
//HtmlElement element = doc.GetElementById("sbVisitedUser");
//string strCnt = (string)element.InnerText.Clone();
//strCnt = strCnt.Substring(0, strCnt.IndexOf("명"));
//strCnt = strCnt.Substring(strCnt.IndexOf("오늘")+"오늘".Length);
//strCnt = strCnt.Trim();
//int iCnt = Convert.ToInt32(strCnt);
//if(iCnt > 3)
// MessageBox.Show(iCnt + "명 : 확인해바라");
} }
void m_Timer_Tick(object sender, EventArgs e) void m_Timer_Tick(object sender, EventArgs e)
{ {
if(wb.IsBusy == false) if(m_bProcessing == false && wb.IsBusy == false)
{
m_bProcessing = true;
wb.Navigate(url); wb.Navigate(url);
}
} }
private void Process_CheckedChanged(object sender, EventArgs e) private void Process_CheckedChanged(object sender, EventArgs e)
{ {
if(Process.Checked == true) if(Process.Checked == true)
{
m_Timer.Start(); m_Timer.Start();
url = tbURL.Text;
tbURL.Enabled = false;
}
else else
{
m_Timer.Stop(); m_Timer.Stop();
tbURL.Enabled = true;
if(wb.IsBusy == true)
wb.Stop();
}
} }
} }
} }