PLayer
authorPAMPHILE Jonathan <pamphile@efrei.fr>
Thu, 24 Sep 2009 18:30:56 +0200
changeset 119 7a370bfb4d77
parent 117 c1222ecbf1b1
child 120 8b83e6c8718e
PLayer
src/FingersDance.Control.Player/UserControlPlayer.xaml.cs
src/FingersDance.Control.SyncSource/UserControlSyncSource.xaml.cs
src/FingersDance.Control.UserPanel/UserControlUserPanel.xaml.cs
src/FingersDance/MainSurfaceWindow.xaml.cs
--- a/src/FingersDance.Control.Player/UserControlPlayer.xaml.cs	Thu Sep 24 18:13:36 2009 +0200
+++ b/src/FingersDance.Control.Player/UserControlPlayer.xaml.cs	Thu Sep 24 18:30:56 2009 +0200
@@ -21,12 +21,18 @@
 
         public event EventHandler PlayerOpened;
 
-		public UserControlPlayer()
-		{
-			this.InitializeComponent();
+        public UserControlPlayer()
+        {
+            this.InitializeComponent();
             initPlayer();
         }
 
+        public UserControlPlayer(string path)
+        {
+            this.InitializeComponent();
+            initPlayer(path);
+        }
+
         #region Properties
         public double TotalMilliseconds
         {
@@ -65,6 +71,18 @@
             MediaElementVideo.ScrubbingEnabled= true;
         }
 
+        public void initPlayer(string path)
+        {
+            //init player
+            isPlaying = false;
+            //Pour se diriger vers le Dossier ressources du projet et non le bin/ressources
+            //DirectoryInfo info = Directory.GetParent(@".");
+            MediaElementVideo.Source = new Uri(path, UriKind.Relative);
+            MediaElementVideo.LoadedBehavior = MediaState.Manual;
+            MediaElementVideo.UnloadedBehavior = MediaState.Manual;
+            MediaElementVideo.ScrubbingEnabled = true;
+        }
+
         public void playerPause()
         {
             MediaElementVideo.Pause();
--- a/src/FingersDance.Control.SyncSource/UserControlSyncSource.xaml.cs	Thu Sep 24 18:13:36 2009 +0200
+++ b/src/FingersDance.Control.SyncSource/UserControlSyncSource.xaml.cs	Thu Sep 24 18:30:56 2009 +0200
@@ -20,6 +20,12 @@
 			// Insert code required on object creation below this point.
 		}
 
+        public UserControlSyncSource(string path)
+        {
+            this.InitializeComponent();
+
+            this.UserControlPlayer.initPlayer(path);
+        }
 
         #region player
         private void UserControlPlayer_PlayerOpened(object sender, EventArgs e)
--- a/src/FingersDance.Control.UserPanel/UserControlUserPanel.xaml.cs	Thu Sep 24 18:13:36 2009 +0200
+++ b/src/FingersDance.Control.UserPanel/UserControlUserPanel.xaml.cs	Thu Sep 24 18:30:56 2009 +0200
@@ -18,5 +18,13 @@
 
 			// Insert code required on object creation below this point.
 		}
+
+        public UserControlUserPanel(string path)
+        {
+            this.InitializeComponent();
+
+            this.UserControlSyncSource = new FingersDance.Control.SyncSource.UserControlSyncSource(path);
+            // Insert code required on object creation below this point.
+        }
 	}
 }
\ No newline at end of file
--- a/src/FingersDance/MainSurfaceWindow.xaml.cs	Thu Sep 24 18:13:36 2009 +0200
+++ b/src/FingersDance/MainSurfaceWindow.xaml.cs	Thu Sep 24 18:30:56 2009 +0200
@@ -298,25 +298,25 @@
                 switch (((UserControlScreen)sender).id)
                 {
                     case 1:
-                        Panel1 = new UserControlUserPanel();
+                        Panel1 = new UserControlUserPanel(((UserControlScreen)sender).Path);
                         Panel1.Name = "UserPanel1";
                         //3-Rajout sur la Grid Root
                         root.Children.Add(Panel1);
                         break;
                     case 2:
-                        Panel2 = new UserControlUserPanel();
+                        Panel2 = new UserControlUserPanel(((UserControlScreen)sender).Path);
                         Panel2.Name = "UserPanel2";
                         //3-Rajout sur la Grid Root
                         root.Children.Add(Panel2);
                         break;
                     case 3:
-                        Panel3 = new UserControlUserPanel();
+                        Panel3 = new UserControlUserPanel(((UserControlScreen)sender).Path);
                         Panel3.Name = "UserPanel3";
                         //3-Rajout sur la Grid Root
                         root.Children.Add(Panel3);
                         break;
                     case 4:
-                        Panel4 = new UserControlUserPanel();
+                        Panel4 = new UserControlUserPanel(((UserControlScreen)sender).Path);
                         Panel4.Name = "UserPanel4";
                         //3-Rajout sur la Grid Root
                         root.Children.Add(Panel4);