--- a/src/FingersDance.GestureControl/GestureControl.cs Thu Nov 12 16:15:19 2009 +0100
+++ b/src/FingersDance.GestureControl/GestureControl.cs Thu Nov 12 23:50:31 2009 +0100
@@ -27,6 +27,8 @@
{
public class GestureControl : ContentControl
{
+ public double time;
+ double start = -1;
private double angle = 0;
public static readonly DependencyProperty GestureProperty;
Thread inProgess;
@@ -55,9 +57,9 @@
remove { RemoveHandler(gestureEvent, value); }
}
- public delegate void RaiseGestureEventCallBack(string gesture);
+ public delegate void RaiseGestureEventCallBack(Gesture gesture);
- public void RaiseGestureEvent(string gesture)
+ public void RaiseGestureEvent(Gesture gesture)
{
if (this.Dispatcher.CheckAccess())
{
@@ -104,6 +106,8 @@
// get angle from the first contact of the stroke
protected void AreaDown(object source, RoutedEventArgs e)
{
+ if (start == -1)
+ start = time;
ContactEventArgs c = (ContactEventArgs)e;
this.angle = c.Contact.GetOrientation(this) - 270;
}
@@ -147,6 +151,7 @@
catch { }
}
+
void RunCapture()
{
try
@@ -156,9 +161,10 @@
string gesture = GetPattern(_Gestures);
if (gesture != "None")
{
- this.RaiseGestureEvent(gesture);
+ this.RaiseGestureEvent(new Gesture{Start=start, End=time, Name=gesture});
}
_Gestures.Clear();
+ start = -1;
inProgess = null;
}
catch (Exception)