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