User Control Player
authorsarias
Sun, 09 Aug 2009 18:29:41 +0200
changeset 34 9e222810f5b5
parent 33 644464191714
child 35 ed77793b767a
User Control Player User Control TimeLine + Communication du player et TimeLine dans User Panel
src/FingersDance.Control.Player/UserControlPlayer.xaml
src/FingersDance.Control.Player/UserControlPlayer.xaml.cs
src/FingersDance.Control.TimeLine/App.xaml
src/FingersDance.Control.TimeLine/FingersDance.Control.TimeLine.csproj
src/FingersDance.Control.TimeLine/Lake.wmv
src/FingersDance.Control.TimeLine/Properties/Resources.Designer.cs
src/FingersDance.Control.TimeLine/Properties/Resources.resx
src/FingersDance.Control.TimeLine/SurfaceTimeLineTest.xaml
src/FingersDance.Control.TimeLine/SurfaceTimeLineTest.xaml.cs
src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml
src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml.cs
src/FingersDance.Control.UserPanel/App.xaml
src/FingersDance.Control.UserPanel/FingersDance.Control.UserPanel.csproj
src/FingersDance.Control.UserPanel/SurfaceUserPanelTest.xaml
src/FingersDance.Control.UserPanel/SurfaceUserPanelTest.xaml.cs
src/FingersDance.Control.UserPanel/SurfaceWindow1.xaml
src/FingersDance.Control.UserPanel/SurfaceWindow1.xaml.cs
test/SliderTest/SliderTest/SurfaceWindow1.xaml.cs
--- a/src/FingersDance.Control.Player/UserControlPlayer.xaml	Fri Aug 07 01:03:14 2009 +0200
+++ b/src/FingersDance.Control.Player/UserControlPlayer.xaml	Sun Aug 09 18:29:41 2009 +0200
@@ -12,88 +12,12 @@
 	</UserControl.Resources>
 	<UserControl.Triggers>
 	</UserControl.Triggers>
-
-	<StackPanel x:Name="LayoutRoot" Width="331.873" Height="227.096" Background="{x:Null}">
-		<Grid Width="327.873" Height="191" MaxWidth="500">
-			<Grid.Background>
-				<DrawingBrush Stretch="Uniform">
-					<DrawingBrush.Drawing>
-						<DrawingGroup ClipGeometry="F1M0,0L449,0 449,257 0,257 0,0">
-							<GeometryDrawing Geometry="F1M41.4948,0.499939L407.505,0.499939C430.146,0.499939,448.5,18.8539,448.5,41.4948L448.5,215.505C448.5,238.146,430.146,256.5,407.505,256.5L41.4948,256.5C18.8539,256.5,0.499908,238.146,0.499908,215.505L0.499908,41.4948C0.499908,18.8539,18.8539,0.499939,41.4948,0.499939z">
-								<GeometryDrawing.Brush>
-									<LinearGradientBrush EndPoint="1.15822,0.125047" StartPoint="0.0699942,0.125047">
-										<LinearGradientBrush.RelativeTransform>
-											<TransformGroup>
-												<SkewTransform AngleX="26.3094" AngleY="0" CenterX="0.0699942" CenterY="0.125047"/>
-												<RotateTransform Angle="43.5596" CenterX="0.0699942" CenterY="0.125047"/>
-											</TransformGroup>
-										</LinearGradientBrush.RelativeTransform>
-										<GradientStop Color="#FF717779" Offset="0"/>
-										<GradientStop Color="#FFD5DBDD" Offset="0.365297"/>
-										<GradientStop Color="#FF9DA1A3" Offset="0.515982"/>
-										<GradientStop Color="#FFD5DBDD" Offset="0.73516"/>
-										<GradientStop Color="#FF717779" Offset="1"/>
-									</LinearGradientBrush>
-								</GeometryDrawing.Brush>
-								<GeometryDrawing.Pen>
-									<Pen Brush="#FFFFFFFF" LineJoin="Round" Thickness="0.999875"/>
-								</GeometryDrawing.Pen>
-							</GeometryDrawing>
-							<GeometryDrawing Geometry="F1M16.4993,16.5139L432.499,16.5139 432.499,242.486 16.4993,242.486 16.4993,16.5139z">
-								<GeometryDrawing.Brush>
-									<RadialGradientBrush Center="0.500001,0.5" GradientOrigin="0.500001,0.5" RadiusX="0.501116" RadiusY="0.876953">
-										<RadialGradientBrush.RelativeTransform>
-											<TransformGroup/>
-										</RadialGradientBrush.RelativeTransform>
-										<GradientStop Color="#FFA8D3E5" Offset="0.0776256"/>
-										<GradientStop Color="#FFB5C2C7" Offset="0.872146"/>
-										<GradientStop Color="#FFEAEDEF" Offset="1"/>
-									</RadialGradientBrush>
-								</GeometryDrawing.Brush>
-								<GeometryDrawing.Pen>
-									<Pen Brush="#FFFFFFFF" LineJoin="Round" Thickness="0.999875"/>
-								</GeometryDrawing.Pen>
-							</GeometryDrawing>
-						</DrawingGroup>
-					</DrawingBrush.Drawing>
-				</DrawingBrush>
-			</Grid.Background>
-			<Grid Margin="12.366,13.976,12.819,12.508" Background="{x:Null}">
-				<MediaElement x:Name="MediaElementVideo" />
-			</Grid>
-		</Grid>
-		<Custom:SurfaceButton FontSize="12" FontWeight="Bold" x:Name="ButtonPlayPause" Content="Play/Pause" Width="37.873" Height="36.096" ContactDown="ButtonPlayPause_ContactDown" Click="ButtonPlayPause_Click" Foreground="{x:Null}">
-			<Custom:SurfaceButton.Background>
-				<DrawingBrush Stretch="Uniform">
-					<DrawingBrush.Drawing>
-						<DrawingGroup ClipGeometry="F1M0,0L65.9998,0 65.9998,65.9998 0,65.9998 0,0">
-							<GeometryDrawing Geometry="F1M32.9999,0.999878C50.6729,0.999878 64.9999,15.3268 64.9999,32.9999 64.9999,50.6729 50.673,64.9998 32.9999,64.9998 15.3268,64.9998 0.999878,50.6729 0.999878,32.9999 0.999878,15.3268 15.3268,0.999878 32.9999,0.999878z">
-								<GeometryDrawing.Brush>
-									<RadialGradientBrush Center="0.5,0.5" GradientOrigin="0.5,0.5" RadiusX="0.515623" RadiusY="0.515623">
-										<RadialGradientBrush.RelativeTransform>
-											<TransformGroup/>
-										</RadialGradientBrush.RelativeTransform>
-										<GradientStop Color="#FFCFCFBD" Offset="0"/>
-										<GradientStop Color="#FFCFCFBD" Offset="0.301369"/>
-										<GradientStop Color="#FFE7E7DE" Offset="0.584094"/>
-										<GradientStop Color="#FFFFFFFF" Offset="0.584475"/>
-										<GradientStop Color="#FFCFCFBD" Offset="0.844749"/>
-									</RadialGradientBrush>
-								</GeometryDrawing.Brush>
-								<GeometryDrawing.Pen>
-									<Pen Brush="#00B0AEAE" LineJoin="Round" Thickness="1.99975"/>
-								</GeometryDrawing.Pen>
-							</GeometryDrawing>
-							<GeometryDrawing Brush="#FF000000" Geometry="F1M46.4136,33.1028L25.7166,20.8713 25.4724,44.9112 46.4136,33.1028z"/>
-							<GeometryDrawing Brush="#64FFFFFF" Geometry="F1M33.0439,6.26428C49.0601,6.26428 62.0439,17.9319 62.0439,32.3246 62.0439,46.7173 49.0601,28.6581 33.0439,28.6581 17.0276,28.6581 4.04395,46.7173 4.04395,32.3246 4.04395,17.9319 17.0278,6.26428 33.0439,6.26428z">
-								<GeometryDrawing.Pen>
-									<Pen Brush="#3AFFFFFF" LineJoin="Round" Thickness="1.99975"/>
-								</GeometryDrawing.Pen>
-							</GeometryDrawing>
-						</DrawingGroup>
-					</DrawingBrush.Drawing>
-				</DrawingBrush>
-			</Custom:SurfaceButton.Background>
-		</Custom:SurfaceButton>
-	</StackPanel>
-</UserControl>
\ No newline at end of file
+        <StackPanel x:Name="LayoutRoot" Width="331.873" Height="227.096" Background="{x:Null}">
+            <Grid Width="321.873" Height="225.096" MaxWidth="500" Background="#FF000000">
+                <MediaElement x:Name="MediaElementVideo" MediaOpened="MediaElementVideo_MediaOpened" />
+                <Custom:SurfaceButton x:Name="Rewind_area" Content="Play/Pause" ContactDown="ButtonRewind_ContactDown" Click="ButtonRewind_Click" Foreground="{x:Null}" Background="#FFF7F0F0" BorderBrush="{x:Null}" Opacity="0" Width="72" HorizontalAlignment="Left"/>
+                <Custom:SurfaceButton x:Name="Fast_Forward_area" Content="Play/Pause" ContactDown="ButtonFastForward_ContactDown" Click="ButtonFastForward_Click" Foreground="{x:Null}" Background="#FFF7F0F0" BorderBrush="{x:Null}" Opacity="0" Width="72" HorizontalAlignment="Right"/>
+                <Custom:SurfaceButton x:Name="Play_Pause_area" ContactDown="ButtonPlayPause_ContactDown" Click="ButtonPlayPause_Click" Foreground="{x:Null}" Margin="76,0,76,0" Background="#FFF7F0F0" BorderBrush="{x:Null}" Opacity="0"/>
+            </Grid>
+        </StackPanel>
+ </UserControl>
\ No newline at end of file
--- a/src/FingersDance.Control.Player/UserControlPlayer.xaml.cs	Fri Aug 07 01:03:14 2009 +0200
+++ b/src/FingersDance.Control.Player/UserControlPlayer.xaml.cs	Sun Aug 09 18:29:41 2009 +0200
@@ -14,29 +14,72 @@
 {
 	public partial class UserControlPlayer
 	{
+        #region Variables
+        private bool isPlaying = false;
+        #endregion
 
-        private bool play;
+        public event EventHandler PlayerOpened;
 
 		public UserControlPlayer()
 		{
 			this.InitializeComponent();
-             
             initPlayer();
-		}
+        }
 
+        #region Properties
+        public double TotalMilliseconds
+        {
+            get
+            {
+                return MediaElementVideo.NaturalDuration.TimeSpan.TotalMilliseconds;
+            }
+        }
+        public MediaElement Player
+        {
+            get
+            {
+                return MediaElementVideo;
+            }
+            set
+            {
+                MediaElementVideo= value;
+            }
+        }
+
+        #endregion
+
+
+        #region Methodes
         void initPlayer()
-        { 
+        {
             //init player
-            play = false;
+            isPlaying = false;
             MediaElementVideo.Source = new Uri("Resources\\Lake.wmv", UriKind.Relative);
             MediaElementVideo.LoadedBehavior = MediaState.Manual;
+            MediaElementVideo.UnloadedBehavior = MediaState.Manual;
+            MediaElementVideo.ScrubbingEnabled= true;
         }
 
+        public void playerPause()
+        {
+            MediaElementVideo.Pause();
+        }
+        public void playerPlay()
+        {
+            MediaElementVideo.Play();
+        }
+        public void playerStop()
+        {
+            MediaElementVideo.Stop();
+        }
+        
+        #endregion
+
         private void ButtonPlayPause_ContactDown(object sender, Microsoft.Surface.Presentation.ContactEventArgs e)
         {
-            if (!play)//Play
+            if (!isPlaying)//Play
             {
-                play = true;
+                isPlaying = true;
                 try
                 {
                     MediaElementVideo.Play();
@@ -45,38 +88,87 @@
             }
             else//Pause
             {
-                play = false;
+                isPlaying = false;
                 try
                 {
                     MediaElementVideo.Pause();
                 }
-                catch (Exception exx ) { }
+                catch (Exception exx) { }
             }
 
         }
 
         private void ButtonPlayPause_Click(object sender, RoutedEventArgs e)
         {
-            if (!play)//Play
+            if (!isPlaying)//Play
             {
-                play = true;
+                isPlaying = true;
                 try
                 {
                     MediaElementVideo.Play();
                 }
-                catch (Exception ex ) { }
-                ButtonPlayPause.Background = FindResource("[Skin_1]_Pause_button_xaml") as Brush;
+                catch (Exception ex) { }
+
             }
             else//Pause
             {
-                play = false;
+                isPlaying = false;
                 try
                 {
                     MediaElementVideo.Pause();
                 }
-                catch (Exception exx ) { }
-                ButtonPlayPause.Background = FindResource("[Skin_1]_Play_button_xaml") as Brush;
+                catch (Exception exx) { }
+                //ButtonPlayPause.Background = FindResource("[Skin_1]_Play_button_xaml") as Brush;
+            }
+        }
+
+        private void ButtonFastForward_Click(object sender, RoutedEventArgs e)
+        {
+            if (MediaElementVideo.SpeedRatio <= 3)
+                MediaElementVideo.SpeedRatio += 1;
+        }
+
+        private void ButtonFastForward_ContactDown(object sender, Microsoft.Surface.Presentation.ContactEventArgs e)
+        {
+            if (MediaElementVideo.SpeedRatio <= 3)
+                MediaElementVideo.SpeedRatio += 1;
+        }
+
+        private void ButtonRewind_Click(object sender, RoutedEventArgs e)
+        {
+            //TimeSpan ts = new TimeSpan(0, 0, 0, 0);
+            if (MediaElementVideo.SpeedRatio > 1)
+            {
+                MediaElementVideo.SpeedRatio -= 1;
             }
+            else
+            {
+                MediaElementVideo.Position = MediaElementVideo.Position.Add(new TimeSpan(0, 0, 0, -5));
+            }
+        }
+
+        private void ButtonRewind_ContactDown(object sender, Microsoft.Surface.Presentation.ContactEventArgs e)
+        {
+
+            //TimeSpan ts = new TimeSpan(0, 0, 0,0);
+            if (MediaElementVideo.SpeedRatio > 1)
+            {
+                MediaElementVideo.SpeedRatio -= 1;
+            }
+            else
+            {
+                MediaElementVideo.Position = MediaElementVideo.Position.Add(new TimeSpan(0, 0, 0, -5));
+            }
+        }
+
+        private void MediaElementVideo_MediaOpened(object sender, RoutedEventArgs e)
+        {
+            OnPlayerOpened();
+        }
+        protected virtual void OnPlayerOpened()
+        {
+            if(PlayerOpened!=null)
+                PlayerOpened(this, new EventArgs());
         }
 	}
 }
\ No newline at end of file
--- a/src/FingersDance.Control.TimeLine/App.xaml	Fri Aug 07 01:03:14 2009 +0200
+++ b/src/FingersDance.Control.TimeLine/App.xaml	Sun Aug 09 18:29:41 2009 +0200
@@ -1,7 +1,7 @@
 <Application x:Class="FingersDance.Control.TimeLine.App"
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-    StartupUri="SurfaceTimeLineTest.xaml"
+    StartupUri="UserControlTimeLine.xaml"
     >
     <Application.Resources>
       <ResourceDictionary>
--- a/src/FingersDance.Control.TimeLine/FingersDance.Control.TimeLine.csproj	Fri Aug 07 01:03:14 2009 +0200
+++ b/src/FingersDance.Control.TimeLine/FingersDance.Control.TimeLine.csproj	Sun Aug 09 18:29:41 2009 +0200
@@ -80,9 +80,6 @@
     <Compile Include="UserControlTimeLine.xaml.cs">
       <DependentUpon>UserControlTimeLine.xaml</DependentUpon>
     </Compile>
-    <Content Include="Lake.wmv">
-      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
-    </Content>
   </ItemGroup>
   <ItemGroup>
     <ApplicationDefinition Include="App.xaml">
@@ -115,9 +112,6 @@
       <DesignTimeSharedInput>True</DesignTimeSharedInput>
       <DependentUpon>Settings.settings</DependentUpon>
     </Compile>
-    <Compile Include="SurfaceTimeLineTest.xaml.cs">
-      <DependentUpon>SurfaceTimeLineTest.xaml</DependentUpon>
-    </Compile>
     <AppDesigner Include="Properties\" />
   </ItemGroup>
   <ItemGroup>
@@ -132,11 +126,5 @@
   <ItemGroup>
     <Resource Include="Resources\WindowBackground.jpg" />
   </ItemGroup>
-  <ItemGroup>
-    <Page Include="SurfaceTimeLineTest.xaml">
-      <Generator>MSBuild:Compile</Generator>
-      <SubType>Designer</SubType>
-    </Page>
-  </ItemGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
 </Project>
\ No newline at end of file
Binary file src/FingersDance.Control.TimeLine/Lake.wmv has changed
--- a/src/FingersDance.Control.TimeLine/Properties/Resources.Designer.cs	Fri Aug 07 01:03:14 2009 +0200
+++ b/src/FingersDance.Control.TimeLine/Properties/Resources.Designer.cs	Sun Aug 09 18:29:41 2009 +0200
@@ -8,11 +8,10 @@
 // </auto-generated>
 //------------------------------------------------------------------------------
 
-namespace FingersDance.Control.TimeLine.Properties
-{
+namespace FingersDance.Control.TimeLine.Properties {
     using System;
-
-
+    
+    
     /// <summary>
     ///   A strongly-typed resource class, for looking up localized strings, etc.
     /// </summary>
@@ -23,48 +22,40 @@
     [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
     [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
-    internal class Resources
-    {
-
+    internal class Resources {
+        
         private static global::System.Resources.ResourceManager resourceMan;
-
+        
         private static global::System.Globalization.CultureInfo resourceCulture;
-
+        
         [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
-        internal Resources()
-        {
+        internal Resources() {
         }
-
+        
         /// <summary>
         ///   Returns the cached ResourceManager instance used by this class.
         /// </summary>
         [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
-        internal static global::System.Resources.ResourceManager ResourceManager
-        {
-            get
-            {
-                if (object.ReferenceEquals(resourceMan, null))
-                {
-                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WPFAppTemplate.Properties.Resources", typeof(Resources).Assembly);
+        internal static global::System.Resources.ResourceManager ResourceManager {
+            get {
+                if (object.ReferenceEquals(resourceMan, null)) {
+                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("FingersDance.Control.TimeLine.Properties.Resources", typeof(Resources).Assembly);
                     resourceMan = temp;
                 }
                 return resourceMan;
             }
         }
-
+        
         /// <summary>
         ///   Overrides the current thread's CurrentUICulture property for all
         ///   resource lookups using this strongly typed resource class.
         /// </summary>
         [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
-        internal static global::System.Globalization.CultureInfo Culture
-        {
-            get
-            {
+        internal static global::System.Globalization.CultureInfo Culture {
+            get {
                 return resourceCulture;
             }
-            set
-            {
+            set {
                 resourceCulture = value;
             }
         }
--- a/src/FingersDance.Control.TimeLine/Properties/Resources.resx	Fri Aug 07 01:03:14 2009 +0200
+++ b/src/FingersDance.Control.TimeLine/Properties/Resources.resx	Sun Aug 09 18:29:41 2009 +0200
@@ -46,7 +46,7 @@
     
     mimetype: application/x-microsoft.net.object.binary.base64
     value   : The object must be serialized with 
-            : System.Serialization.Formatters.Binary.BinaryFormatter
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
             : and then encoded with base64 encoding.
     
     mimetype: application/x-microsoft.net.object.soap.base64
@@ -60,6 +60,7 @@
             : and then encoded with base64 encoding.
     -->
   <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
     <xsd:element name="root" msdata:IsDataSet="true">
       <xsd:complexType>
         <xsd:choice maxOccurs="unbounded">
@@ -68,9 +69,10 @@
               <xsd:sequence>
                 <xsd:element name="value" type="xsd:string" minOccurs="0" />
               </xsd:sequence>
-              <xsd:attribute name="name" type="xsd:string" />
+              <xsd:attribute name="name" use="required" type="xsd:string" />
               <xsd:attribute name="type" type="xsd:string" />
               <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
             </xsd:complexType>
           </xsd:element>
           <xsd:element name="assembly">
@@ -85,9 +87,10 @@
                 <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
                 <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
               </xsd:sequence>
-              <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
               <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
               <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
             </xsd:complexType>
           </xsd:element>
           <xsd:element name="resheader">
@@ -109,9 +112,9 @@
     <value>2.0</value>
   </resheader>
   <resheader name="reader">
-    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </resheader>
   <resheader name="writer">
-    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </resheader>
 </root>
\ No newline at end of file
--- a/src/FingersDance.Control.TimeLine/SurfaceTimeLineTest.xaml	Fri Aug 07 01:03:14 2009 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-<s:SurfaceWindow
-    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
-    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-    xmlns:s="http://schemas.microsoft.com/surface/2008"
-    xmlns:FingersDance_Control_TimeLine="clr-namespace:FingersDance.Control.TimeLine"
-    x:Class="FingersDance.Control.TimeLine.SurfaceTimeLineTest"
-    Title="FingersDance.Control.TimeLine" Activated="SurfaceWindow_Activated"
-    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
-    >
-  <s:SurfaceWindow.Resources>
-    <ImageBrush x:Key="WindowBackground" Stretch="None" Opacity="0.6" ImageSource="pack://application:,,,/Resources/WindowBackground.jpg"/>
-  </s:SurfaceWindow.Resources>
-
-  <Grid Background="{StaticResource WindowBackground}" >
-
-  	<Grid Margin="187,224,198,120">
-  		<MediaElement Source="Lake.wmv" MediaEnded="MediaElement_MediaEnded" x:Name="mediaelement" MediaOpened="mediaelement_MediaOpened" Volume="0"/>
-
-  	</Grid>
-
-  	<s:SurfaceSlider Margin="187,128,229,0" VerticalAlignment="Top" Height="53" x:Name="sliderBase" ValueChanged="sliderBase_ValueChanged" Value="0" DragEnter="sliderBase_DragEnter" DragLeave="sliderBase_DragLeave" ContactEnter="sliderBase_ContactEnter" ContactLeave="sliderBase_ContactLeave" ContactChanged="sliderBase_ContactChanged"/>
-  	<Label Margin="187,37,0,0" Content="SliderPosition" Height="35" VerticalAlignment="Top" Width="161" HorizontalAlignment="Left"/>
-  	<Label Margin="187,81,374,0" VerticalAlignment="Top" Height="24" Content="content" x:Name="labelPosition"/>
-  	<Label HorizontalAlignment="Left" Margin="27,248,0,226" Width="101" Content="MediaDuration"/>
-  	<Label HorizontalAlignment="Left" Margin="27,0,0,186" VerticalAlignment="Bottom" Width="191" Height="40" Content="duration" x:Name="labelDuration"/>
-  	<s:SurfaceButton Margin="0,0,229,63" VerticalAlignment="Bottom" Height="41" Content="Play/Pause" x:Name="butonPlayPause" Click="butonPlayPause_Click" HorizontalAlignment="Right" Width="117"/>
-
-  	<Label Margin="0,233,8,231" Content="Media Position Miliseconds" HorizontalAlignment="Right" x:Name="labelMediaPosition" Width="182"/>
-  	<Label Margin="0,0,-1,214" Content="content" x:Name="labelMediaPositionContent" HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="191" Height="24"/>
-  	<s:SurfaceButton Margin="247,0,0,63" VerticalAlignment="Bottom" Height="38" Content="Stop" Click="SurfaceButton_Click" ContactDown="SurfaceButton_ContactDown" HorizontalAlignment="Left" Width="67"/>
-  	<Label Margin="0,21,43,0" Content="SliderMax" VerticalAlignment="Top" Height="35" Width="161" HorizontalAlignment="Right"/>
-  	<Label Margin="0,70,43,0" Content="content" VerticalAlignment="Top" Height="35" HorizontalAlignment="Right" Width="161" x:Name="labelSliderMax" IsEnabled="False"/>
-  	<Label Margin="0,0,12,115" Content="content" HorizontalAlignment="Right" x:Name="labelMediaPositionToString" Width="182" Height="35" VerticalAlignment="Bottom"/>
-  	<Label Margin="0,0,-1,150" Content="MediaPosition Normal" x:Name="labelMediaPositionNormal" HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="191" Height="24"/>
-
-  </Grid>
-</s:SurfaceWindow>
--- a/src/FingersDance.Control.TimeLine/SurfaceTimeLineTest.xaml.cs	Fri Aug 07 01:03:14 2009 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,254 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Shapes;
-using System.Windows.Threading;
-using Microsoft.Surface;
-using Microsoft.Surface.Presentation;
-using Microsoft.Surface.Presentation.Controls;
-
-namespace FingersDance.Control.TimeLine
-{
-    /// <summary>
-    /// Interaction logic for SurfaceWindow1.xaml
-    /// </summary>
-    public partial class SurfaceTimeLineTest : SurfaceWindow
-    {
-
-        DispatcherTimer timer;  // handles position of slider and player
-        bool isDragging = false;
-        bool isPlaying = false;
-
-
-
-        /// <summary>
-        /// Default constructor.
-        /// </summary>
-        public SurfaceTimeLineTest()
-        {
-            InitializeComponent();
-
-            // Add handlers for Application activation events
-            initplayer();
-            AddActivationHandlers();
-        }
-
-        #region Handlers
-        /// <summary>
-        /// Occurs when the window is about to close. 
-        /// </summary>
-        /// <param name="e"></param>
-        protected override void OnClosed(EventArgs e)
-        {
-            base.OnClosed(e);
-
-            // Remove handlers for Application activation events
-            RemoveActivationHandlers();
-        }
-
-        /// <summary>
-        /// Adds handlers for Application activation events.
-        /// </summary>
-        private void AddActivationHandlers()
-        {
-            // Subscribe to surface application activation events
-            ApplicationLauncher.ApplicationActivated += OnApplicationActivated;
-            ApplicationLauncher.ApplicationPreviewed += OnApplicationPreviewed;
-            ApplicationLauncher.ApplicationDeactivated += OnApplicationDeactivated;
-        }
-
-        /// <summary>
-        /// Removes handlers for Application activation events.
-        /// </summary>
-        private void RemoveActivationHandlers()
-        {
-            // Unsubscribe from surface application activation events
-            ApplicationLauncher.ApplicationActivated -= OnApplicationActivated;
-            ApplicationLauncher.ApplicationPreviewed -= OnApplicationPreviewed;
-            ApplicationLauncher.ApplicationDeactivated -= OnApplicationDeactivated;
-        }
-
-        /// <summary>
-        /// This is called when application has been activated.
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        private void OnApplicationActivated(object sender, EventArgs e)
-        {
-            //TODO: enable audio, animations here
-        }
-
-        /// <summary>
-        /// This is called when application is in preview mode.
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        private void OnApplicationPreviewed(object sender, EventArgs e)
-        {
-            //TODO: Disable audio here if it is enabled
-
-            //TODO: optionally enable animations here
-        }
-
-        /// <summary>
-        ///  This is called when application has been deactivated.
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        private void OnApplicationDeactivated(object sender, EventArgs e)
-        {
-            //TODO: disable audio, animations here
-        }
-        #endregion
-
-        #region SurfaceWindows events
-
-        private void SurfaceWindow_Activated(object sender, EventArgs e)
-        {
-            timer = new DispatcherTimer();
-            //timer.Interval = TimeSpan.FromSeconds(1);
-            timer.Interval = TimeSpan.FromMilliseconds(250);
-            timer.Tick += new EventHandler(timer_Tick);
-        }
-        #endregion
-
-        #region Timer
-        void timer_Tick(object sender, EventArgs e)
-        {
-            //Slider Position
-            labelPosition.Content = sliderBase.Value;
-            //Media Position ToString and TotalMilliseconds
-            labelMediaPositionToString.Content=mediaelement.Position.ToString();
-            labelMediaPositionContent.Content = mediaelement.Position.TotalMilliseconds;
-            //Si le slider n'est pas en train d'etre bougé, on change sa valeur
-            if (!isDragging)
-            {
-                sliderBase.Value = mediaelement.Position.TotalMilliseconds;
-            }
-
-        }
-        #endregion
-
-        #region MediaElement events
-        private void MediaElement_MediaEnded(object sender, RoutedEventArgs e)
-        {
-            mediaelement.Stop();
-        }
-
-        private void mediaelement_MediaOpened(object sender, RoutedEventArgs e)
-        {
-            labelDuration.Content = mediaelement.NaturalDuration.ToString();
-
-            sliderBase.Maximum = mediaelement.NaturalDuration.TimeSpan.TotalMilliseconds;
-            labelSliderMax.Content = sliderBase.Maximum;
-            //initialisation du timer
-            timer.Start();
-        }
-        #endregion
-
-        #region Slider
-
-        private void sliderBase_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
-        {
-            //TODO
-            if (!isDragging)
-            {
-
-                int SliderValue = (int)sliderBase.Value;
-
-                // Overloaded constructor takes the arguments days, hours, minutes, seconds, miniseconds.
-                // Create a TimeSpan with miliseconds equal to the slider value.
-                TimeSpan ts = new TimeSpan(0, 0, 0, 0, SliderValue);
-                mediaelement.Position = ts;
-                mediaelement.Play();
-            }
-            
-        }
-
-        private void sliderBase_DragEnter(object sender, DragEventArgs e)
-        {
-            isDragging = true;
-            mediaelement.Pause();
-        }
-
-        private void sliderBase_DragLeave(object sender, DragEventArgs e)
-        {
-            isDragging = false;
-            //mediaelement.Position = TimeSpan.FromSeconds(sliderBase.Value);
-
-        }
-
-        private void sliderBase_ContactEnter(object sender, ContactEventArgs e)
-        {
-            isDragging = true;
-            mediaelement.Pause();
-        }
-
-        private void sliderBase_ContactLeave(object sender, ContactEventArgs e)
-        {
-            isDragging = false;
-            mediaelement.Position = TimeSpan.FromSeconds(sliderBase.Value);
-        }
-
-        private void sliderBase_ContactChanged(object sender, ContactEventArgs e)
-        {
-           // isDragging = false;
-            //mediaelement.Position = TimeSpan.FromMilliseconds(sliderBase.Value);
-        }
-        #endregion
-
-        #region Player
-        private void initplayer()
-        {
-            mediaelement.LoadedBehavior = MediaState.Manual;        
-        }
-
-        private void butonPlayPause_Click(object sender, RoutedEventArgs e)
-        {
-            if (!isPlaying)//Play
-            {
-                isPlaying = true;
-                try
-                {
-                    mediaelement.Play();
-                }
-                catch (Exception ex) { }
-            }
-            else//Pause
-            {
-                isPlaying = false;
-                try
-                {
-                    mediaelement.Pause();
-                }
-                catch (Exception exx) { }
-            }
-        }
-        private void SurfaceButton_Click(object sender, RoutedEventArgs e)
-        {
-            mediaelement.Stop();
-        }
-
-        private void SurfaceButton_ContactDown(object sender, ContactEventArgs e)
-        {
-            mediaelement.Stop();
-        }
-
-    #endregion
-
-
-
-
-
-    }
-        
-
-}
\ No newline at end of file
--- a/src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml	Fri Aug 07 01:03:14 2009 +0200
+++ b/src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml	Sun Aug 09 18:29:41 2009 +0200
@@ -6,11 +6,9 @@
 	mc:Ignorable="d"
 	x:Class="FingersDance.Control.TimeLine.UserControlTimeLine"
 	x:Name="UserControl"
-	d:DesignWidth="575" xmlns:Custom="http://schemas.microsoft.com/surface/2008" Height="88" Background="#FF898686">
+	d:DesignWidth="575" xmlns:Custom="http://schemas.microsoft.com/surface/2008" Height="Auto" Background="#FF898686">
 
-	<Grid x:Name="LayoutRoot" Background="#FFFFFFFF" Height="88" Width="575">
-		<Custom:SurfaceSlider ValueChanged="SurfaceSlider_ValueChanged" Margin="0,0,0,8" Height="27" VerticalAlignment="Bottom" x:Name="SurfaceSlider" Value="0.5"/>
-		<Label HorizontalAlignment="Left" Margin="20,8,0,39" Width="243" Content="" x:Name="LabelSliderPosition" Background="#FCA8A8A8"/>
-		<Label HorizontalAlignment="Right" Margin="0,12,31,35" Width="243" Content="" x:Name="LabelSliderDuration" Background="#FFB2B2B2"/>
-	</Grid>
+	<StackPanel x:Name="LayoutRoot" Width="Auto" Height="Auto" Background="#4CFCFCFC">
+		<Custom:SurfaceSlider  Height="27" x:Name="slider" Value="0.5" Width="575" Thumb.DragStarted="sliderPosition_DragStarted" Thumb.DragCompleted="sliderPosition_DragCompleted" />
+	</StackPanel>
 </UserControl>
\ No newline at end of file
--- a/src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml.cs	Fri Aug 07 01:03:14 2009 +0200
+++ b/src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml.cs	Sun Aug 09 18:29:41 2009 +0200
@@ -7,21 +7,79 @@
 using System.Windows.Media;
 using System.Windows.Media.Animation;
 using System.Windows.Navigation;
+using System.Windows.Controls.Primitives;
+using Microsoft.Surface.Presentation.Controls;
+using System.Windows.Threading;
 
 namespace FingersDance.Control.TimeLine
 {
 	public partial class UserControlTimeLine
-	{
-        public Microsoft.Surface.Presentation.Controls.SurfaceSlider Slider
+    {
+
+        #region Variables
+        private DispatcherTimer timer;
+        private bool isDragging = false;
+        private bool finishedDragging = false;
+        #endregion
+
+        public event EventHandler DragStarted;
+        public event EventHandler DragCompleted;
+        public event EventHandler TimerTick;
+
+        #region Properties
+
+        public SurfaceSlider Slider
         {
-            get {
-                return SurfaceSlider;
+            get
+            {
+                return slider;
             }
-            set {
-                SurfaceSlider = value;
+            set
+            {
+                slider = value;
             }
         }
         
+        public bool IsDragging
+        {
+            get
+            {
+                return isDragging;
+            }
+            set
+            {
+                isDragging = value;
+            }
+        }
+
+        public bool FinishedDragging
+        {
+            get
+            {
+                return finishedDragging;
+            }
+            set
+            {
+                finishedDragging = value;
+            }
+        }
+
+        public DispatcherTimer Timer
+        {
+            get
+            {
+                return timer;
+            }
+            set
+            {
+                timer = value;
+            }
+        }
+        #endregion
+        
+
+
+        
 		public UserControlTimeLine()
 		{
 			this.InitializeComponent();
@@ -29,15 +87,73 @@
 			// Insert code required on object creation below this point.
 		}
 
-        private void SurfaceSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
+        public void initslider(double totalmilliseconds)
+        {
+            slider.Maximum = totalmilliseconds;
+        }
+
+        #region Timer
+        public void initTimer()
+        {
+            timer = new DispatcherTimer();
+            timer.Interval = new TimeSpan(0, 0, 0, 0, 100);
+            timer.Tick += new EventHandler(timer_Tick);
+        }
+
+        public void timerStart()
+        {
+            if (timer != null)
+                timer.Start();
+        }
+        void timer_Tick(object sender, EventArgs e)
         {
-            /*TimeSpan ts = TimeSpan.FromSeconds(e.NewValue);
-            LabelSliderPosition.Content =
-                String.Format("{0:00}:{1:00}:{2:00}",
-                ts.Hours, ts.Minutes, ts.Seconds);
-            SurfaceSlider.Maximum = ts.TotalSeconds;
-            SurfaceSlider.SmallChange = 1;
-            SurfaceSlider.LargeChange = Math.Min(10, ts.Seconds / 10);*/
+            OnTimerTick();
+            if (!isDragging)
+            {
+                //slider.Value = media.Position.TotalMilliseconds;
+            }
+            if (finishedDragging)
+            {
+                //int SliderValue = (int)slider.Value;
+                //TimeSpan ts = new TimeSpan(0, 0, 0, 0, SliderValue);
+               // media.Position = ts;
+               // media.Play();
+               // isDragging = false;
+                //finishedDragging = false;
+            }
+        }
+        protected virtual void OnTimerTick()
+        {
+            if (TimerTick != null)
+                TimerTick(this, new EventArgs());
         }
+
+        #endregion
+
+        private void sliderPosition_DragStarted(
+            object sender, DragStartedEventArgs e)
+        {
+            isDragging = true;
+            OnDragStarted();
+           // media.Pause();
+        }
+        protected virtual void OnDragStarted()
+        {
+            if (DragStarted != null)
+                DragStarted(this, new EventArgs());
+        }
+
+        private void sliderPosition_DragCompleted(
+            object sender, DragCompletedEventArgs e)
+        {
+            finishedDragging = true;
+            OnDragCompleted();
+        }
+        protected virtual void OnDragCompleted()
+        {
+            if (DragCompleted != null)
+                DragCompleted(this, new EventArgs());
+        }
+
 	}
 }
\ No newline at end of file
--- a/src/FingersDance.Control.UserPanel/App.xaml	Fri Aug 07 01:03:14 2009 +0200
+++ b/src/FingersDance.Control.UserPanel/App.xaml	Sun Aug 09 18:29:41 2009 +0200
@@ -1,7 +1,7 @@
 <Application x:Class="FingersDance.Control.UserPanel.App"
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-    StartupUri="SurfaceWindow1.xaml"
+    StartupUri="SurfaceUserPanelTest.xaml"
     >
     <Application.Resources>
       <ResourceDictionary>
--- a/src/FingersDance.Control.UserPanel/FingersDance.Control.UserPanel.csproj	Fri Aug 07 01:03:14 2009 +0200
+++ b/src/FingersDance.Control.UserPanel/FingersDance.Control.UserPanel.csproj	Sun Aug 09 18:29:41 2009 +0200
@@ -105,8 +105,8 @@
       <DesignTimeSharedInput>True</DesignTimeSharedInput>
       <DependentUpon>Settings.settings</DependentUpon>
     </Compile>
-    <Compile Include="SurfaceWindow1.xaml.cs">
-      <DependentUpon>SurfaceWindow1.xaml</DependentUpon>
+    <Compile Include="SurfaceUserPanelTest.xaml.cs">
+      <DependentUpon>SurfaceUserPanelTest.xaml</DependentUpon>
     </Compile>
     <AppDesigner Include="Properties\" />
   </ItemGroup>
@@ -123,10 +123,20 @@
     <Resource Include="Resources\WindowBackground.jpg" />
   </ItemGroup>
   <ItemGroup>
-    <Page Include="SurfaceWindow1.xaml">
+    <Page Include="SurfaceUserPanelTest.xaml">
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
     </Page>
   </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\FingersDance.Control.Player\FingersDance.Control.Player.csproj">
+      <Project>{D5625AA4-362F-4E46-9916-65F3B173ECBE}</Project>
+      <Name>FingersDance.Control.Player</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\FingersDance.Control.TimeLine\FingersDance.Control.TimeLine.csproj">
+      <Project>{2BCEE1BF-D3AC-478C-A26B-DFDB7420E965}</Project>
+      <Name>FingersDance.Control.TimeLine</Name>
+    </ProjectReference>
+  </ItemGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
 </Project>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/FingersDance.Control.UserPanel/SurfaceUserPanelTest.xaml	Sun Aug 09 18:29:41 2009 +0200
@@ -0,0 +1,19 @@
+<s:SurfaceWindow
+    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+    xmlns:s="http://schemas.microsoft.com/surface/2008"
+	xmlns:FingersDance_Control_Player="clr-namespace:FingersDance.Control.Player;assembly=FingersDance.Control.Player"
+    xmlns:FingersDance_Control_TimeLine="clr-namespace:FingersDance.Control.TimeLine;assembly=FingersDance.Control.TimeLine"
+    x:Class="FingersDance.Control.UserPanel.SurfaceWindow1"
+    Title="FingersDance.Control.UserPanel"
+	xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" Activated="SurfaceWindow_Activated"
+    >
+  <s:SurfaceWindow.Resources>
+    <ImageBrush x:Key="WindowBackground" Stretch="None" Opacity="0.6" ImageSource="pack://application:,,,/Resources/WindowBackground.jpg"/>
+  </s:SurfaceWindow.Resources>
+
+  <Grid Background="{StaticResource WindowBackground}" >
+  	<FingersDance_Control_TimeLine:UserControlTimeLine Margin="182,89,206,0" VerticalAlignment="Top" Height="34" x:Name="UserControlTimeLine" DragStarted="UserControlTimeLine_DragStarted" DragCompleted="UserControlTimeLine_DragCompleted" TimerTick="UserControlTimeLine_TimerTick"/>
+    <FingersDance_Control_Player:UserControlPlayer d:LayoutOverrides="Margin" Margin="196.064,196.452,220.064,74.452" PlayerOpened="UserControlPlayer_PlayerOpened" x:Name="UserControlPlayer" />
+    </Grid>
+</s:SurfaceWindow>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/FingersDance.Control.UserPanel/SurfaceUserPanelTest.xaml.cs	Sun Aug 09 18:29:41 2009 +0200
@@ -0,0 +1,146 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+using System.Windows.Threading;
+using Microsoft.Surface;
+using Microsoft.Surface.Presentation;
+using Microsoft.Surface.Presentation.Controls;
+
+namespace FingersDance.Control.UserPanel
+{
+    /// <summary>
+    /// Interaction logic for SurfaceWindow1.xaml
+    /// </summary>
+    public partial class SurfaceWindow1 : SurfaceWindow
+    {
+        /// <summary>
+        /// Default constructor.
+        /// </summary>
+        public SurfaceWindow1()
+        {
+            InitializeComponent();
+
+            // Add handlers for Application activation events
+            AddActivationHandlers();
+        }
+
+
+        /// <summary>
+        /// Occurs when the window is about to close. 
+        /// </summary>
+        /// <param name="e"></param>
+        protected override void OnClosed(EventArgs e)
+        {
+            base.OnClosed(e);
+
+            // Remove handlers for Application activation events
+            RemoveActivationHandlers();
+        }
+
+        /// <summary>
+        /// Adds handlers for Application activation events.
+        /// </summary>
+        private void AddActivationHandlers()
+        {
+            // Subscribe to surface application activation events
+            ApplicationLauncher.ApplicationActivated += OnApplicationActivated;
+            ApplicationLauncher.ApplicationPreviewed += OnApplicationPreviewed;
+            ApplicationLauncher.ApplicationDeactivated += OnApplicationDeactivated;
+        }
+
+        /// <summary>
+        /// Removes handlers for Application activation events.
+        /// </summary>
+        private void RemoveActivationHandlers()
+        {
+            // Unsubscribe from surface application activation events
+            ApplicationLauncher.ApplicationActivated -= OnApplicationActivated;
+            ApplicationLauncher.ApplicationPreviewed -= OnApplicationPreviewed;
+            ApplicationLauncher.ApplicationDeactivated -= OnApplicationDeactivated;
+        }
+
+        /// <summary>
+        /// This is called when application has been activated.
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void OnApplicationActivated(object sender, EventArgs e)
+        {
+            //TODO: enable audio, animations here
+        }
+
+        /// <summary>
+        /// This is called when application is in preview mode.
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void OnApplicationPreviewed(object sender, EventArgs e)
+        {
+            //TODO: Disable audio here if it is enabled
+
+            //TODO: optionally enable animations here
+        }
+
+        /// <summary>
+        ///  This is called when application has been deactivated.
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void OnApplicationDeactivated(object sender, EventArgs e)
+        {
+            //TODO: disable audio, animations here
+        }
+
+        private void UserControlPlayer_PlayerOpened(object sender, EventArgs e)
+        {
+            //Initialisation du slider
+            UserControlTimeLine.initslider(UserControlPlayer.TotalMilliseconds);
+            //Demarrage du Timer
+            UserControlTimeLine.timerStart();
+
+        }
+
+        private void SurfaceWindow_Activated(object sender, EventArgs e)
+        {
+            //initialisation du Timer
+            UserControlTimeLine.initTimer();
+        }
+
+        private void UserControlTimeLine_DragStarted(object sender, EventArgs e)
+        {
+            UserControlPlayer.playerPause();
+        }
+
+        private void UserControlTimeLine_DragCompleted(object sender, EventArgs e)
+        {
+        }
+
+        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;
+            }
+        }
+    }
+}
\ No newline at end of file
--- a/src/FingersDance.Control.UserPanel/SurfaceWindow1.xaml	Fri Aug 07 01:03:14 2009 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-<s:SurfaceWindow x:Class="FingersDance.Control.UserPanel.SurfaceWindow1"
-    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
-    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-    xmlns:s="http://schemas.microsoft.com/surface/2008"
-    Title="FingersDance.Control.UserPanel"
-    >
-  <s:SurfaceWindow.Resources>
-    <ImageBrush x:Key="WindowBackground" Stretch="None" Opacity="0.6" ImageSource="pack://application:,,,/Resources/WindowBackground.jpg"/>
-  </s:SurfaceWindow.Resources>
-
-  <Grid Background="{StaticResource WindowBackground}" >
-
-  </Grid>
-</s:SurfaceWindow>
--- a/src/FingersDance.Control.UserPanel/SurfaceWindow1.xaml.cs	Fri Aug 07 01:03:14 2009 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Shapes;
-using System.Windows.Threading;
-using Microsoft.Surface;
-using Microsoft.Surface.Presentation;
-using Microsoft.Surface.Presentation.Controls;
-
-namespace FingersDance.Control.UserPanel
-{
-    /// <summary>
-    /// Interaction logic for SurfaceWindow1.xaml
-    /// </summary>
-    public partial class SurfaceWindow1 : SurfaceWindow
-    {
-        /// <summary>
-        /// Default constructor.
-        /// </summary>
-        public SurfaceWindow1()
-        {
-            InitializeComponent();
-
-            // Add handlers for Application activation events
-            AddActivationHandlers();
-        }
-
-
-        /// <summary>
-        /// Occurs when the window is about to close. 
-        /// </summary>
-        /// <param name="e"></param>
-        protected override void OnClosed(EventArgs e)
-        {
-            base.OnClosed(e);
-
-            // Remove handlers for Application activation events
-            RemoveActivationHandlers();
-        }
-
-        /// <summary>
-        /// Adds handlers for Application activation events.
-        /// </summary>
-        private void AddActivationHandlers()
-        {
-            // Subscribe to surface application activation events
-            ApplicationLauncher.ApplicationActivated += OnApplicationActivated;
-            ApplicationLauncher.ApplicationPreviewed += OnApplicationPreviewed;
-            ApplicationLauncher.ApplicationDeactivated += OnApplicationDeactivated;
-        }
-
-        /// <summary>
-        /// Removes handlers for Application activation events.
-        /// </summary>
-        private void RemoveActivationHandlers()
-        {
-            // Unsubscribe from surface application activation events
-            ApplicationLauncher.ApplicationActivated -= OnApplicationActivated;
-            ApplicationLauncher.ApplicationPreviewed -= OnApplicationPreviewed;
-            ApplicationLauncher.ApplicationDeactivated -= OnApplicationDeactivated;
-        }
-
-        /// <summary>
-        /// This is called when application has been activated.
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        private void OnApplicationActivated(object sender, EventArgs e)
-        {
-            //TODO: enable audio, animations here
-        }
-
-        /// <summary>
-        /// This is called when application is in preview mode.
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        private void OnApplicationPreviewed(object sender, EventArgs e)
-        {
-            //TODO: Disable audio here if it is enabled
-
-            //TODO: optionally enable animations here
-        }
-
-        /// <summary>
-        ///  This is called when application has been deactivated.
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        private void OnApplicationDeactivated(object sender, EventArgs e)
-        {
-            //TODO: disable audio, animations here
-        }
-    }
-}
\ No newline at end of file
--- a/test/SliderTest/SliderTest/SurfaceWindow1.xaml.cs	Fri Aug 07 01:03:14 2009 +0200
+++ b/test/SliderTest/SliderTest/SurfaceWindow1.xaml.cs	Sun Aug 09 18:29:41 2009 +0200
@@ -26,7 +26,6 @@
         DispatcherTimer timer;
         bool isDragging=false;
         bool finishedDragging = false;
-        bool mediaopened = false;
 
         /// <summary>
         /// Default constructor.
@@ -116,7 +115,6 @@
 
         private void media_MediaOpened(object sender, RoutedEventArgs e)
         {
-            mediaopened = true;
             initslider();
             timer.Start();
         }