Commit 499559e3 authored by Gaurav Arora (gaa721)'s avatar Gaurav Arora (gaa721)
Browse files

Bit cleaning of code

parent 13cd32fb
......@@ -24,13 +24,18 @@ namespace FaceDetectionApp
public Form1()
{
InitializeComponent();
#region faceDetector Initializations
FaceDetector.Instance.FrameCapturedEvent += FrameCallback;
FaceDetector.Instance.FaceDetectedEvent += FaceDetectedCallback;
FaceDetector.Instance.FaceLostEvent += FaceLostCallback;
FaceDetector.Instance.ActiveWindowChanged += F_ActiveWindowChanged;
FaceDetector.Instance.AttentionChecker += AttentoinCheck;
textBox1.Text = FaceDetector.Instance.GetActiveWindowTitle().ToString();
#endregion
#region mouseHook and keyboardHook Initialization
actHook = new UserActivityHook(); // crate an instance with global hooks
// hang on events
actHook.OnMouseActivity += new MouseEventHandler(MouseMoved);
......@@ -38,9 +43,10 @@ namespace FaceDetectionApp
actHook.KeyPress += new KeyPressEventHandler(MyKeyPress);
actHook.KeyUp += new KeyEventHandler(MyKeyUp);
actHook.Start();
#endregion
}
#region mouse/keyboard events for hook
public void MouseMoved(object sender, MouseEventArgs e)
{
mouseLabel.Text = String.Format("Last mouse event: " + System.DateTime.Now.ToString());
......@@ -62,6 +68,7 @@ namespace FaceDetectionApp
{
keyboardLabel.Text = String.Format("Last keyboard event: " + System.DateTime.Now.ToString());
}
#endregion
private void AttentoinCheck()
{
......@@ -85,7 +92,7 @@ namespace FaceDetectionApp
}
AttentoinCheck();
}
#region face detection methods
private void FaceDetectedCallback()
{
if (lblFace.InvokeRequired)
......@@ -107,6 +114,6 @@ namespace FaceDetectionApp
if (b != null)
pictureBox1.Image = b;
}
#endregion
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment