src/FingersDance.Control.SyncSource/UserControlSyncSource.xaml.cs
changeset 195 48b3139bb182
parent 193 96374d03e714
child 203 2948b34324bb
child 205 468f3757f1f8
equal deleted inserted replaced
194:d96cd2bce653 195:48b3139bb182
     7 using System.Windows.Media;
     7 using System.Windows.Media;
     8 using System.Windows.Media.Animation;
     8 using System.Windows.Media.Animation;
     9 using System.Windows.Navigation;
     9 using System.Windows.Navigation;
    10 using FingersDance.Control.TimeLine;
    10 using FingersDance.Control.TimeLine;
    11 using FingersDance.Data;
    11 using FingersDance.Data;
       
    12 using FingersDance.Factory;
    12 
    13 
    13 namespace FingersDance.Control.SyncSource
    14 namespace FingersDance.Control.SyncSource
    14 {
    15 {
    15 	public partial class UserControlSyncSource
    16 	public partial class UserControlSyncSource
    16 	{
    17 	{
    29         {
    30         {
    30             this.UserControlPlayer.initPlayer(path);
    31             this.UserControlPlayer.initPlayer(path);
    31             //Initialisation du Timer
    32             //Initialisation du Timer
    32             UCTimeLine.initTimer(col, cut);
    33             UCTimeLine.initTimer(col, cut);
    33             this.UserControlPlayer.playerPlay();
    34             this.UserControlPlayer.playerPlay();
    34             this.userControlTimeLine.OnSuccessAnnotation+=new EventHandler(userControlTimeLine_OnSuccessAnnotation);
    35             this.userControlTimeLine.OnSuccessAnnotation += new EventHandler(userControlTimeLine_OnSuccessAnnotation);
       
    36             this.userControlTimeLine.AnnotationAdded += new EventHandler(userControlTimeLine_AnnotationAdded);
       
    37             this.userControlTimeLine.AnnotationRemoved += new EventHandler(userControlTimeLine_AnnotationRemoved);
    35             this.UserControlPlayer.PlayerStopOrPause +=new EventHandler(UserControlPlayer_PlayerStopOrPause);
    38             this.UserControlPlayer.PlayerStopOrPause +=new EventHandler(UserControlPlayer_PlayerStopOrPause);
       
    39         }
       
    40 
       
    41         void userControlTimeLine_AnnotationRemoved(object sender, EventArgs e)
       
    42         {
       
    43             try
       
    44             {
       
    45                 DataDictionary Data = (new DataFactory()).Data;
       
    46                 Data.RemoveAnnotation((Annotation)sender);
       
    47             }
       
    48             catch { }
       
    49         }
       
    50 
       
    51         //  Ajout Annotation
       
    52         void userControlTimeLine_AnnotationAdded(object sender, EventArgs e)
       
    53         {
       
    54             try
       
    55             {
       
    56                 DataDictionary Data = (new DataFactory()).Data;
       
    57                 Data.AddAnnotation((Annotation)sender);
       
    58             }
       
    59             catch { }
    36         }
    60         }
    37 
    61 
    38         #region player
    62         #region player
    39         private void UserControlPlayer_PlayerOpened(object sender, EventArgs e)
    63         private void UserControlPlayer_PlayerOpened(object sender, EventArgs e)
    40         {
    64         {
    43             //Demarrage du Timer
    67             //Demarrage du Timer
    44             UCTimeLine.timerStart();
    68             UCTimeLine.timerStart();
    45 
    69 
    46         }
    70         }
    47 
    71 
    48         //Set a bursh color to the stack panel in the Player
       
    49         public void UserControlPlayer_DisplayAnnotation(int id, Brush b)
       
    50         {
       
    51             UserControlPlayer.displayStackPanelAnnotations(id, b);
       
    52 
       
    53         }
       
    54         public void UserControlPlayer_PlayerStopOrPause(object sender, EventArgs e)
    72         public void UserControlPlayer_PlayerStopOrPause(object sender, EventArgs e)
    55         {
    73         {
    56             try
    74             try
    57             {
    75             {
    58                 userControlTimeLine.thumbRotation((bool)sender);
    76                 userControlTimeLine.thumbRotation((bool)sender);
   103         {
   121         {
   104             if (!UCTimeLine.IsDragging)
   122             if (!UCTimeLine.IsDragging)
   105             {
   123             {
   106                 UCTimeLine.Slider.Value = UserControlPlayer.Player.Position.TotalMilliseconds;
   124                 UCTimeLine.Slider.Value = UserControlPlayer.Player.Position.TotalMilliseconds;
   107             }
   125             }
       
   126             int SliderValue = (int)UCTimeLine.Slider.Value;
   108             if (UCTimeLine.FinishedDragging)
   127             if (UCTimeLine.FinishedDragging)
   109             {
   128             {
   110                 int SliderValue = (int)UCTimeLine.Slider.Value;
       
   111                 TimeSpan ts = new TimeSpan(0, 0, 0, 0, SliderValue);
   129                 TimeSpan ts = new TimeSpan(0, 0, 0, 0, SliderValue);
   112 
   130 
   113                 UserControlPlayer.Player.Position = ts;
   131                 UserControlPlayer.Player.Position = ts;
   114                 UserControlPlayer.playerPlay();
   132                 UserControlPlayer.playerPlay();
   115                 UserControlPlayer.Time = SliderValue;
   133                 UserControlPlayer.Time = (float)SliderValue / 1000;
   116 
   134 
   117                 UCTimeLine.IsDragging = false;
   135                 UCTimeLine.IsDragging = false;
   118                 UCTimeLine.FinishedDragging = false;
   136                 UCTimeLine.FinishedDragging = false;
   119             }
   137             }
       
   138             DataDictionary Data = (new DataFactory()).Data;
       
   139             UserControlPlayer.ApplyColor(Data.GetColors((int)((float)SliderValue / 1000)));
   120         }
   140         }
   121         #endregion
   141         #endregion
   122 
   142 
   123         public UserControlTimeLine userControlTimeLine
   143         public UserControlTimeLine userControlTimeLine
   124         {
   144         {