src/FingersDance.Control.SyncSource/UserControlSyncSource.xaml.cs
changeset 35 ed77793b767a
child 39 0efa1d506f28
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/FingersDance.Control.SyncSource/UserControlSyncSource.xaml.cs	Mon Aug 17 22:04:09 2009 +0200
@@ -0,0 +1,72 @@
+using System;
+using System.IO;
+using System.Net;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Media;
+using System.Windows.Media.Animation;
+using System.Windows.Navigation;
+
+namespace FingersDance.Control.SyncSource
+{
+	public partial class UserControlSyncSource
+	{
+		public UserControlSyncSource()
+		{
+			this.InitializeComponent();
+
+			// Insert code required on object creation below this point.
+		}
+
+
+        #region player
+        private void UserControlPlayer_PlayerOpened(object sender, EventArgs e)
+        {
+            //Initialisation du Timer
+            UserControlTimeLine.initTimer();
+            //Initialisation du slider
+            UserControlTimeLine.initslider(UserControlPlayer.TotalMilliseconds);
+            //Demarrage du Timer
+            UserControlTimeLine.timerStart();
+
+        }
+        #endregion
+
+        #region TimeLine
+
+
+        private void UserControlTimeLine_DragStarted(object sender, EventArgs e)
+        {
+            UserControlPlayer.playerPause();
+        }
+
+
+        private void UserControlTimeLine_DragCompleted(object sender, EventArgs e)
+        {
+        }
+        #endregion
+
+
+        #region SynSource pour chaque X milliseconds
+        private void UserControlTimeLine_TimerTick(object sender, EventArgs e)
+        {
+            if (!UserControlTimeLine.IsDragging)
+            {
+                UserControlTimeLine.Slider.Value = UserControlPlayer.Player.Position.TotalMilliseconds;
+            }
+            if (UserControlTimeLine.FinishedDragging)
+            {
+                int SliderValue = (int)UserControlTimeLine.Slider.Value;
+                TimeSpan ts = new TimeSpan(0, 0, 0, 0, SliderValue);
+
+                UserControlPlayer.Player.Position = ts;
+                UserControlPlayer.playerPlay();
+
+                UserControlTimeLine.IsDragging = false;
+                UserControlTimeLine.FinishedDragging = false;
+            }
+        }
+        #endregion
+    }
+}
\ No newline at end of file