src/FingersDance.Control.Player/UserControlPlayer.xaml.cs
changeset 195 48b3139bb182
parent 193 96374d03e714
child 197 3455e574e096
--- a/src/FingersDance.Control.Player/UserControlPlayer.xaml.cs	Fri Nov 13 11:58:42 2009 +0100
+++ b/src/FingersDance.Control.Player/UserControlPlayer.xaml.cs	Fri Nov 13 20:10:00 2009 +0100
@@ -31,6 +31,7 @@
 
         public event EventHandler PlayerOpened;
         public event EventHandler PlayerStopOrPause;
+        public event EventHandler NewGestureRegognized;
 
         public double Time
         {
@@ -124,75 +125,80 @@
 
         public void GestureDetected(object sender, GestureControl.GestureRoutedEventArgs e)
         {
-
-            /*
-             *  e.Gesture.Name = Nom de la gesture
-             *  e.Gesture.Start = Valeur de la timeline au début de l'annotation
-             *  e.Gesture.End = Valeur de la timeline à la fin de l'annotation
-             * 
-             */
+            try
+            {
+                /*
+                 *  e.Gesture.Name = Nom de la gesture
+                 *  e.Gesture.Start = Valeur de la timeline au début de l'annotation
+                 *  e.Gesture.End = Valeur de la timeline à la fin de l'annotation
+                 * 
+                 */
+                switch (e.Gesture.Name)
+                {
+                    case "TRIGGER":
 
-            switch (e.Gesture.Name)
-            {
-                case "TRIGGER":
-                    
-                    usercontrolInfoUser.LabelSession.Content = "TRIGGER!";
-                    break;
-                case "CONTRE POINTS":
+                        usercontrolInfoUser.LabelSession.Content = "TRIGGER!";
+                        break;
+                    case "CONTRE POINTS":
 
-                    usercontrolInfoUser.LabelSession.Content = "CONTRE POINTS!";
-                    break;
-                case "CONTRE PESANTEUR":
+                        usercontrolInfoUser.LabelSession.Content = "CONTRE POINTS!";
+                        break;
+                    case "CONTRE PESANTEUR":
 
-                    usercontrolInfoUser.LabelSession.Content = "CONTRE PESANTEUR!";
-                    break;
-                case "AVEC PESANTEUR":
+                        usercontrolInfoUser.LabelSession.Content = "CONTRE PESANTEUR!";
+                        break;
+                    case "AVEC PESANTEUR":
 
-                    usercontrolInfoUser.LabelSession.Content = "AVEC PESANTEUR!";
-                    break;
-                case "ALIGNEMENT":
+                        usercontrolInfoUser.LabelSession.Content = "AVEC PESANTEUR!";
+                        break;
+                    case "ALIGNEMENT":
 
-                    usercontrolInfoUser.LabelSession.Content = "ALIGNEMENT!";
-                    break;
-                case "CONTACT VISUEL":
+                        usercontrolInfoUser.LabelSession.Content = "ALIGNEMENT!";
+                        break;
+                    case "CONTACT VISUEL":
+
+                        usercontrolInfoUser.LabelSession.Content = "CONTACT VISUEL!";
+                        break;
+                    case "MOUVEMENT CONTRAINTE":
 
-                    usercontrolInfoUser.LabelSession.Content = "CONTACT VISUEL!";
-                    break;
-                case "MOUVEMENT CONTRAINTE":
+                        usercontrolInfoUser.LabelSession.Content = "MOUVEMENT CONTRAINTE!";
+                        break;
+                    case "UN DANSEUR":
 
-                    usercontrolInfoUser.LabelSession.Content = "MOUVEMENT CONTRAINTE!";
-                    break;
-                case "UN DANSEUR":
+                        usercontrolInfoUser.LabelSession.Content = "UN DANSEUR!";
+                        break;
+                    case "DEUX DANSEURS":
 
-                    usercontrolInfoUser.LabelSession.Content = "UN DANSEUR!";
-                    break;
-                case "DEUX DANSEURS":
+                        usercontrolInfoUser.LabelSession.Content = "DEUX DANSEURS!";
+                        break;
+                    case "TROIS DANSEURS":
 
-                    usercontrolInfoUser.LabelSession.Content = "DEUX DANSEURS!";
-                    break;
-                case "TROIS DANSEURS":
+                        usercontrolInfoUser.LabelSession.Content = "TROIS DANSEURS!";
+                        break;
+                    case "QUATRE DANSEURS":
 
-                    usercontrolInfoUser.LabelSession.Content = "TROIS DANSEURS!";
-                    break;
-                case "QUATRE DANSEURS":
+                        usercontrolInfoUser.LabelSession.Content = "QUATRE DANSEURS!";
+                        break;
+                    case "TOUS LES DANSEURS":
 
-                    usercontrolInfoUser.LabelSession.Content = "QUATRE DANSEURS!";
-                    break;
-                case "TOUS LES DANSEURS":
+                        usercontrolInfoUser.LabelSession.Content = "TOUS LES DANSEURS!";
+                        break;
+                    case "CONTACT TABLE/DANSEUR":
 
-                    usercontrolInfoUser.LabelSession.Content = "TOUS LES DANSEURS!";
-                    break;
-                case "CONTACT TABLE/DANSEUR":
-
-                    usercontrolInfoUser.LabelSession.Content = "CONTACT TABLE/DANSEUR!";
-                    break;
-                case "PLAY-PAUSE":
-                    usercontrolInfoUser.LabelSession.Content = "PLAY-PAUSE!";
-                    ButtonPlayPause_ContactDown(null, null);
-                    break;
-                default:
-                    break;
+                        usercontrolInfoUser.LabelSession.Content = "CONTACT TABLE/DANSEUR!";
+                        break;
+                    case "PLAY-PAUSE":
+                        usercontrolInfoUser.LabelSession.Content = "PLAY-PAUSE!";
+                        ButtonPlayPause_ContactDown(null, null);
+                        break;
+                    default:
+                        return;
+                }
+                if (!e.Gesture.Name.Equals("PLAY-PAUSE"))
+                    if (NewGestureRegognized != null)
+                        NewGestureRegognized(this, e);
             }
+            catch { }
         }
         #endregion
 
@@ -380,28 +386,37 @@
 
         }
 
+        public void ApplyColor(List<Color> colors)
+        {
+            try
+            {
+                for (int i = 1; i <= colors.Count; i++)
+                    displayStackPanelAnnotations(i, new SolidColorBrush(colors[i - 1]));
+            }
+            catch { }
+        }
+
         //This function Sets a brush in a specific rectangle of the StackPanelAnnotation
         public void displayStackPanelAnnotations(int id, Brush brushAnnotation)
         {
-            Object o = null;
+            rect1.Fill = new SolidColorBrush(Colors.Black);
+            rect2.Fill = new SolidColorBrush(Colors.Black);
+            rect3.Fill = new SolidColorBrush(Colors.Black);
+            rect4.Fill = new SolidColorBrush(Colors.Black);
+
             switch (id)
             {
                 case 1: 
                     rect1.Fill = brushAnnotation;
-                    o = rect1.FindResource("Rect1Annotation");
-                    rect1.BeginStoryboard((Storyboard)o);
                     break;
-                case 2: rect2.Fill = brushAnnotation;
-                    o = rect2.FindResource("Rect2Annotation");
-                    rect2.BeginStoryboard((Storyboard)o);
+                case 2: 
+                    rect2.Fill = brushAnnotation;
                     break;
-                case 3: rect3.Fill = brushAnnotation;
-                    o = rect3.FindResource("Rect3Annotation");
-                    rect3.BeginStoryboard((Storyboard)o);
+                case 3: 
+                    rect3.Fill = brushAnnotation;
                     break;
-                case 4: rect4.Fill = brushAnnotation;
-                    o = rect4.FindResource("Rect4Annotation");
-                    rect4.BeginStoryboard((Storyboard)o);
+                case 4: 
+                    rect4.Fill = brushAnnotation;
                     break;
                 default: break;
             }