src/FingersDance.Control.SyncSource/UserControlSyncSource.xaml.cs
changeset 225 b60e13ed75c8
parent 224 874de6d84a2e
child 229 05aba5def1fc
equal deleted inserted replaced
224:874de6d84a2e 225:b60e13ed75c8
   181                 if (AnnotationOrSearchMode == "Annotation")
   181                 if (AnnotationOrSearchMode == "Annotation")
   182                 {
   182                 {
   183                     // If the stroke has been drawed very fast, end and start can be the same, so we add a little length.
   183                     // If the stroke has been drawed very fast, end and start can be the same, so we add a little length.
   184                     float dur = (float)(grea.End - grea.Start);
   184                     float dur = (float)(grea.End - grea.Start);
   185                     if (dur == 0) dur = (float)0.5;
   185                     if (dur == 0) dur = (float)0.5;
       
   186                     // We build the list of string
       
   187                     List<String> gestList = new List<String>();
   186                     foreach (Gesture elt in grea.Gestures)
   188                     foreach (Gesture elt in grea.Gestures)
   187                         UCTimeLine.addAnnotation((float)grea.Start, dur, elt.Name);
   189                         gestList.Add(elt.Name);
       
   190                     UCTimeLine.addAnnotation((float)grea.Start, dur, gestList);
   188                 }
   191                 }
   189                 else
   192                 else
   190                 {
   193                 {
   191                     // We are in search mode. So we have to get all the searchedProject's annotation which have the wanted gesture
   194                     // We are in search mode. So we have to get all the searchedProject's annotation which have the wanted gesture
   192                     List<Annotation> searchedAnnot = new List<Annotation>();
   195                     List<Annotation> searchedAnnot = new List<Annotation>();
   193                     foreach(Cutting cut in searchedProject.Cuttings)
   196                     foreach(Cutting cut in searchedProject.Cuttings)
   194                     {
   197                     {
   195                         foreach (Annotation annot in cut.AnnotList)
   198                         foreach (Annotation annot in cut.AnnotList)
   196                         {
   199                         {
   197                             foreach(Gesture gest in grea.Gestures)
   200                             foreach(Gesture gest in grea.Gestures)
   198                                 if (annot.GestureType == gest.Name)
   201                                 foreach(String annotGest in annot.GestureType)
   199                                 {
   202                                     if (annotGest == gest.Name)
   200                                     // One of the gesture is enough for the annotation to be added
   203                                     {
   201                                     searchedAnnot.Add(annot);
   204                                         // One of the gesture is enough for the annotation to be added
   202                                     break;
   205                                         searchedAnnot.Add(annot);
   203                                 }
   206                                         break;
       
   207                                     }
   204                         }
   208                         }
   205                     }
   209                     }
   206                     // The list was built. If the number of found annotations is >0, we send the list to the timeline
   210                     // The list was built. If the number of found annotations is >0, we send the list to the timeline
   207                     UCTimeLine.updateAnnotationList(searchedAnnot);
   211                     UCTimeLine.updateAnnotationList(searchedAnnot);
   208                 }
   212                 }
   216             List<Annotation> searchedAnnot = new List<Annotation>();
   220             List<Annotation> searchedAnnot = new List<Annotation>();
   217             foreach (Cutting cut in searchedProject.Cuttings)
   221             foreach (Cutting cut in searchedProject.Cuttings)
   218             {
   222             {
   219                 foreach (Annotation annot in cut.AnnotList)
   223                 foreach (Annotation annot in cut.AnnotList)
   220                 {
   224                 {
   221                     if (annot.GestureType == gestureName)
   225                     foreach (String annotGest in annot.GestureType)
   222                     {
   226                         if (annotGest == gestureName)
   223                         // One of the gesture is enough for the annotation to be added
   227                         {
   224                         searchedAnnot.Add(annot);
   228                             // One of the gesture is enough for the annotation to be added
   225                     }
   229                             searchedAnnot.Add(annot);
       
   230                         }
   226                 }
   231                 }
   227             }
   232             }
   228             // The list was built. If the number of found annotations is >0, we send the list to the timeline
   233             // The list was built. If the number of found annotations is >0, we send the list to the timeline
   229             UCTimeLine.updateAnnotationList(searchedAnnot);
   234             UCTimeLine.updateAnnotationList(searchedAnnot);
   230         }
   235         }