src/FingersDance.Control.SyncSource/UserControlSyncSource.xaml.cs
changeset 35 ed77793b767a
child 39 0efa1d506f28
equal deleted inserted replaced
34:9e222810f5b5 35:ed77793b767a
       
     1 using System;
       
     2 using System.IO;
       
     3 using System.Net;
       
     4 using System.Windows;
       
     5 using System.Windows.Controls;
       
     6 using System.Windows.Data;
       
     7 using System.Windows.Media;
       
     8 using System.Windows.Media.Animation;
       
     9 using System.Windows.Navigation;
       
    10 
       
    11 namespace FingersDance.Control.SyncSource
       
    12 {
       
    13 	public partial class UserControlSyncSource
       
    14 	{
       
    15 		public UserControlSyncSource()
       
    16 		{
       
    17 			this.InitializeComponent();
       
    18 
       
    19 			// Insert code required on object creation below this point.
       
    20 		}
       
    21 
       
    22 
       
    23         #region player
       
    24         private void UserControlPlayer_PlayerOpened(object sender, EventArgs e)
       
    25         {
       
    26             //Initialisation du Timer
       
    27             UserControlTimeLine.initTimer();
       
    28             //Initialisation du slider
       
    29             UserControlTimeLine.initslider(UserControlPlayer.TotalMilliseconds);
       
    30             //Demarrage du Timer
       
    31             UserControlTimeLine.timerStart();
       
    32 
       
    33         }
       
    34         #endregion
       
    35 
       
    36         #region TimeLine
       
    37 
       
    38 
       
    39         private void UserControlTimeLine_DragStarted(object sender, EventArgs e)
       
    40         {
       
    41             UserControlPlayer.playerPause();
       
    42         }
       
    43 
       
    44 
       
    45         private void UserControlTimeLine_DragCompleted(object sender, EventArgs e)
       
    46         {
       
    47         }
       
    48         #endregion
       
    49 
       
    50 
       
    51         #region SynSource pour chaque X milliseconds
       
    52         private void UserControlTimeLine_TimerTick(object sender, EventArgs e)
       
    53         {
       
    54             if (!UserControlTimeLine.IsDragging)
       
    55             {
       
    56                 UserControlTimeLine.Slider.Value = UserControlPlayer.Player.Position.TotalMilliseconds;
       
    57             }
       
    58             if (UserControlTimeLine.FinishedDragging)
       
    59             {
       
    60                 int SliderValue = (int)UserControlTimeLine.Slider.Value;
       
    61                 TimeSpan ts = new TimeSpan(0, 0, 0, 0, SliderValue);
       
    62 
       
    63                 UserControlPlayer.Player.Position = ts;
       
    64                 UserControlPlayer.playerPlay();
       
    65 
       
    66                 UserControlTimeLine.IsDragging = false;
       
    67                 UserControlTimeLine.FinishedDragging = false;
       
    68             }
       
    69         }
       
    70         #endregion
       
    71     }
       
    72 }