diff -r d13dbcf861d7 -r 45d2dff788f2 src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml.cs --- a/src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml.cs Thu Nov 19 18:05:52 2009 +0100 +++ b/src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml.cs Fri Nov 20 17:14:52 2009 +0100 @@ -36,6 +36,7 @@ public event EventHandler TimerTick; public event EventHandler AnnotationAdded; public event EventHandler AnnotationRemoved; + public event EventHandler NewGestureRecognized; //SAR public event EventHandler OnSuccessAnnotation; //ENDSAR @@ -301,6 +302,11 @@ } + public void addAnnotation(float start, float dur, String gestureType) + { + addAnnotation(new AnnotationViewModel(new Annotation("temp", start, dur, gestureType, CurrentColor), 0)); + } + public void startOrEndAnnotation(String gestureType) { Boolean annotOk = true; @@ -361,22 +367,6 @@ } } - - public void UserControlPlayer_NewGestureRegognized(object sender, EventArgs e) - { - try - { - GestureEventArg grea = (GestureEventArg)e; - //Console.WriteLine("Timeline NewGestureRegognized " + grea.Gesture.Name + ", " + grea.Gesture.Start + ", " + grea.Gesture.End); - // If the stroke has been drawed very fast, end and start can be the same, so we add a little length. - float dur = (float)(grea.End - grea.Start); - if (dur == 0) dur = (float)0.5; - foreach(Gesture elt in grea.Gestures) - addAnnotation(new AnnotationViewModel(new Annotation("temp", (float)grea.Start, (float)(grea.End - grea.Start), elt.Name, CurrentColor), 0)); - } - catch { } - } - private void listview_PreviewContactDown(object sender, Microsoft.Surface.Presentation.ContactEventArgs e) { FrameworkElement findSource = e.OriginalSource as FrameworkElement; @@ -485,6 +475,42 @@ canceledAnnotationVM = null; } + // + // Is search mode, function of the search gesture, we have to be able to update frequently the current list of annotation + // + public void updateAnnotationList(List la) + { + tv.DataContext = new CuttingViewModel(new Cutting("temp", "search", la), AnnotWidth, tv.ScaleX); + } + + // + // Is search mode, we need the timeline to send the NewGestureEvent + // + public void sendNewGesture(String gestureName) + { + NewGestureRecognized(this, new NewGestureRecognizedEventArg(gestureName)); + } + } + + + /// + /// AnnotationOrSearchEventArg + /// + public class NewGestureRecognizedEventArg : EventArgs + { + public String GestureName + { + get; + set; + } + + public NewGestureRecognizedEventArg(String gestureName) + { + + GestureName = gestureName; + + } + } } \ No newline at end of file