This commit is contained in:
27
Form1.cs
27
Form1.cs
@@ -7,6 +7,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.IO;
|
||||
|
||||
namespace WebChecker
|
||||
{
|
||||
@@ -24,6 +25,8 @@ namespace WebChecker
|
||||
|
||||
DateTime m_LastCheckT;
|
||||
|
||||
StreamWriter m_FileLog = new StreamWriter("WebChecker.log", true);
|
||||
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
@@ -37,6 +40,8 @@ namespace WebChecker
|
||||
|
||||
wb.ScriptErrorsSuppressed = true;
|
||||
wb.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(wb_DocumentCompleted);
|
||||
|
||||
Log("=== App Launch ===");
|
||||
}
|
||||
|
||||
void Alert(string message)
|
||||
@@ -49,6 +54,20 @@ namespace WebChecker
|
||||
FlashWindow.Stop(this);
|
||||
}
|
||||
|
||||
void Log(string message)
|
||||
{
|
||||
Console.WriteLine("[" + DateTime.Now + "] " + message);
|
||||
m_FileLog.WriteLine("[" + DateTime.Now + "] " + message);
|
||||
m_FileLog.Flush();
|
||||
}
|
||||
|
||||
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
notifyIcon1.Visible = false;
|
||||
Log("=== App Closing ===");
|
||||
m_FileLog.Close();
|
||||
}
|
||||
|
||||
void wb_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
|
||||
{
|
||||
if(e.Url.Host != wb.Url.Host)
|
||||
@@ -73,6 +92,7 @@ namespace WebChecker
|
||||
if(attr.IndexOf("login") >= 0)
|
||||
{
|
||||
Process.Checked = false;
|
||||
Log(url + " checked");
|
||||
Alert("logged in");
|
||||
}
|
||||
|
||||
@@ -110,6 +130,7 @@ namespace WebChecker
|
||||
m_LastCheckT = DateTime.Now - TimeSpan.FromMilliseconds(CHECK_PERIOD-1000);
|
||||
|
||||
m_Timer.Start();
|
||||
Log(url + " check start");
|
||||
|
||||
url = tbURL.Text;
|
||||
tbURL.Enabled = false;
|
||||
@@ -123,6 +144,7 @@ namespace WebChecker
|
||||
lbStatus.Text = "상태 : 대기";
|
||||
|
||||
m_Timer.Stop();
|
||||
Log(url + " check stop");
|
||||
|
||||
tbURL.Enabled = true;
|
||||
if(wb.IsBusy == true)
|
||||
@@ -144,11 +166,6 @@ namespace WebChecker
|
||||
}
|
||||
}
|
||||
|
||||
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
notifyIcon1.Visible = false;
|
||||
}
|
||||
|
||||
private void notifyIcon1_MouseClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
this.Show();
|
||||
|
||||
Reference in New Issue
Block a user