src/FingersDance.Control.Player/UserControlPlayer.xaml.cs
changeset 195 48b3139bb182
parent 193 96374d03e714
child 197 3455e574e096
equal deleted inserted replaced
194:d96cd2bce653 195:48b3139bb182
    29         private bool isPlaying = false;
    29         private bool isPlaying = false;
    30         #endregion
    30         #endregion
    31 
    31 
    32         public event EventHandler PlayerOpened;
    32         public event EventHandler PlayerOpened;
    33         public event EventHandler PlayerStopOrPause;
    33         public event EventHandler PlayerStopOrPause;
       
    34         public event EventHandler NewGestureRegognized;
    34 
    35 
    35         public double Time
    36         public double Time
    36         {
    37         {
    37             get { return gestureControl.time; }
    38             get { return gestureControl.time; }
    38             set { gestureControl.time = value; }
    39             set { gestureControl.time = value; }
   122 
   123 
   123         #region GestureEvents
   124         #region GestureEvents
   124 
   125 
   125         public void GestureDetected(object sender, GestureControl.GestureRoutedEventArgs e)
   126         public void GestureDetected(object sender, GestureControl.GestureRoutedEventArgs e)
   126         {
   127         {
   127 
   128             try
   128             /*
   129             {
   129              *  e.Gesture.Name = Nom de la gesture
   130                 /*
   130              *  e.Gesture.Start = Valeur de la timeline au début de l'annotation
   131                  *  e.Gesture.Name = Nom de la gesture
   131              *  e.Gesture.End = Valeur de la timeline à la fin de l'annotation
   132                  *  e.Gesture.Start = Valeur de la timeline au début de l'annotation
   132              * 
   133                  *  e.Gesture.End = Valeur de la timeline à la fin de l'annotation
   133              */
   134                  * 
   134 
   135                  */
   135             switch (e.Gesture.Name)
   136                 switch (e.Gesture.Name)
   136             {
   137                 {
   137                 case "TRIGGER":
   138                     case "TRIGGER":
   138                     
   139 
   139                     usercontrolInfoUser.LabelSession.Content = "TRIGGER!";
   140                         usercontrolInfoUser.LabelSession.Content = "TRIGGER!";
   140                     break;
   141                         break;
   141                 case "CONTRE POINTS":
   142                     case "CONTRE POINTS":
   142 
   143 
   143                     usercontrolInfoUser.LabelSession.Content = "CONTRE POINTS!";
   144                         usercontrolInfoUser.LabelSession.Content = "CONTRE POINTS!";
   144                     break;
   145                         break;
   145                 case "CONTRE PESANTEUR":
   146                     case "CONTRE PESANTEUR":
   146 
   147 
   147                     usercontrolInfoUser.LabelSession.Content = "CONTRE PESANTEUR!";
   148                         usercontrolInfoUser.LabelSession.Content = "CONTRE PESANTEUR!";
   148                     break;
   149                         break;
   149                 case "AVEC PESANTEUR":
   150                     case "AVEC PESANTEUR":
   150 
   151 
   151                     usercontrolInfoUser.LabelSession.Content = "AVEC PESANTEUR!";
   152                         usercontrolInfoUser.LabelSession.Content = "AVEC PESANTEUR!";
   152                     break;
   153                         break;
   153                 case "ALIGNEMENT":
   154                     case "ALIGNEMENT":
   154 
   155 
   155                     usercontrolInfoUser.LabelSession.Content = "ALIGNEMENT!";
   156                         usercontrolInfoUser.LabelSession.Content = "ALIGNEMENT!";
   156                     break;
   157                         break;
   157                 case "CONTACT VISUEL":
   158                     case "CONTACT VISUEL":
   158 
   159 
   159                     usercontrolInfoUser.LabelSession.Content = "CONTACT VISUEL!";
   160                         usercontrolInfoUser.LabelSession.Content = "CONTACT VISUEL!";
   160                     break;
   161                         break;
   161                 case "MOUVEMENT CONTRAINTE":
   162                     case "MOUVEMENT CONTRAINTE":
   162 
   163 
   163                     usercontrolInfoUser.LabelSession.Content = "MOUVEMENT CONTRAINTE!";
   164                         usercontrolInfoUser.LabelSession.Content = "MOUVEMENT CONTRAINTE!";
   164                     break;
   165                         break;
   165                 case "UN DANSEUR":
   166                     case "UN DANSEUR":
   166 
   167 
   167                     usercontrolInfoUser.LabelSession.Content = "UN DANSEUR!";
   168                         usercontrolInfoUser.LabelSession.Content = "UN DANSEUR!";
   168                     break;
   169                         break;
   169                 case "DEUX DANSEURS":
   170                     case "DEUX DANSEURS":
   170 
   171 
   171                     usercontrolInfoUser.LabelSession.Content = "DEUX DANSEURS!";
   172                         usercontrolInfoUser.LabelSession.Content = "DEUX DANSEURS!";
   172                     break;
   173                         break;
   173                 case "TROIS DANSEURS":
   174                     case "TROIS DANSEURS":
   174 
   175 
   175                     usercontrolInfoUser.LabelSession.Content = "TROIS DANSEURS!";
   176                         usercontrolInfoUser.LabelSession.Content = "TROIS DANSEURS!";
   176                     break;
   177                         break;
   177                 case "QUATRE DANSEURS":
   178                     case "QUATRE DANSEURS":
   178 
   179 
   179                     usercontrolInfoUser.LabelSession.Content = "QUATRE DANSEURS!";
   180                         usercontrolInfoUser.LabelSession.Content = "QUATRE DANSEURS!";
   180                     break;
   181                         break;
   181                 case "TOUS LES DANSEURS":
   182                     case "TOUS LES DANSEURS":
   182 
   183 
   183                     usercontrolInfoUser.LabelSession.Content = "TOUS LES DANSEURS!";
   184                         usercontrolInfoUser.LabelSession.Content = "TOUS LES DANSEURS!";
   184                     break;
   185                         break;
   185                 case "CONTACT TABLE/DANSEUR":
   186                     case "CONTACT TABLE/DANSEUR":
   186 
   187 
   187                     usercontrolInfoUser.LabelSession.Content = "CONTACT TABLE/DANSEUR!";
   188                         usercontrolInfoUser.LabelSession.Content = "CONTACT TABLE/DANSEUR!";
   188                     break;
   189                         break;
   189                 case "PLAY-PAUSE":
   190                     case "PLAY-PAUSE":
   190                     usercontrolInfoUser.LabelSession.Content = "PLAY-PAUSE!";
   191                         usercontrolInfoUser.LabelSession.Content = "PLAY-PAUSE!";
   191                     ButtonPlayPause_ContactDown(null, null);
   192                         ButtonPlayPause_ContactDown(null, null);
   192                     break;
   193                         break;
   193                 default:
   194                     default:
   194                     break;
   195                         return;
   195             }
   196                 }
       
   197                 if (!e.Gesture.Name.Equals("PLAY-PAUSE"))
       
   198                     if (NewGestureRegognized != null)
       
   199                         NewGestureRegognized(this, e);
       
   200             }
       
   201             catch { }
   196         }
   202         }
   197         #endregion
   203         #endregion
   198 
   204 
   199         #region Button Simple Player Actions
   205         #region Button Simple Player Actions
   200         private void ButtonPlayPause_ContactDown(object sender, Microsoft.Surface.Presentation.ContactEventArgs e)
   206         private void ButtonPlayPause_ContactDown(object sender, Microsoft.Surface.Presentation.ContactEventArgs e)
   378                     ab.Execute();
   384                     ab.Execute();
   379             }
   385             }
   380 
   386 
   381         }
   387         }
   382 
   388 
       
   389         public void ApplyColor(List<Color> colors)
       
   390         {
       
   391             try
       
   392             {
       
   393                 for (int i = 1; i <= colors.Count; i++)
       
   394                     displayStackPanelAnnotations(i, new SolidColorBrush(colors[i - 1]));
       
   395             }
       
   396             catch { }
       
   397         }
       
   398 
   383         //This function Sets a brush in a specific rectangle of the StackPanelAnnotation
   399         //This function Sets a brush in a specific rectangle of the StackPanelAnnotation
   384         public void displayStackPanelAnnotations(int id, Brush brushAnnotation)
   400         public void displayStackPanelAnnotations(int id, Brush brushAnnotation)
   385         {
   401         {
   386             Object o = null;
   402             rect1.Fill = new SolidColorBrush(Colors.Black);
       
   403             rect2.Fill = new SolidColorBrush(Colors.Black);
       
   404             rect3.Fill = new SolidColorBrush(Colors.Black);
       
   405             rect4.Fill = new SolidColorBrush(Colors.Black);
       
   406 
   387             switch (id)
   407             switch (id)
   388             {
   408             {
   389                 case 1: 
   409                 case 1: 
   390                     rect1.Fill = brushAnnotation;
   410                     rect1.Fill = brushAnnotation;
   391                     o = rect1.FindResource("Rect1Annotation");
       
   392                     rect1.BeginStoryboard((Storyboard)o);
       
   393                     break;
   411                     break;
   394                 case 2: rect2.Fill = brushAnnotation;
   412                 case 2: 
   395                     o = rect2.FindResource("Rect2Annotation");
   413                     rect2.Fill = brushAnnotation;
   396                     rect2.BeginStoryboard((Storyboard)o);
       
   397                     break;
   414                     break;
   398                 case 3: rect3.Fill = brushAnnotation;
   415                 case 3: 
   399                     o = rect3.FindResource("Rect3Annotation");
   416                     rect3.Fill = brushAnnotation;
   400                     rect3.BeginStoryboard((Storyboard)o);
       
   401                     break;
   417                     break;
   402                 case 4: rect4.Fill = brushAnnotation;
   418                 case 4: 
   403                     o = rect4.FindResource("Rect4Annotation");
   419                     rect4.Fill = brushAnnotation;
   404                     rect4.BeginStoryboard((Storyboard)o);
       
   405                     break;
   420                     break;
   406                 default: break;
   421                 default: break;
   407             }
   422             }
   408         }
   423         }
   409 	}
   424 	}