MVVM
authorPAMPHILE Jonathan <pamphile@efrei.fr>
Tue, 13 Oct 2009 19:33:13 +0200
changeset 143 9f157d9c725b
parent 142 3d66ca73df55
child 144 843f65b41290
MVVM
src/FingersDance.ActionFactory/ActionFactory.cs
src/FingersDance.ActionFactory/ActionGenerator.cs
src/FingersDance.ActionFactory/FingersDance.ActionFactory.csproj
src/FingersDance.Actions/ActionAddAnnotation.cs
src/FingersDance.Actions/FingersDance.Actions.csproj
src/FingersDance.Control.Close/FingersDance.Control.Close.csproj
src/FingersDance.Control.Close/UserControlClose.xaml
src/FingersDance.Control.Close/UserControlClose.xaml.cs
src/FingersDance.Control.ListVideo/FingersDance.Control.ListVideo.csproj
src/FingersDance.Control.ListVideo/UserControlListVideo.xaml.cs
src/FingersDance.Control.Player/FingersDance.Control.Player.csproj
src/FingersDance.Control.Player/UserControlPlayer.xaml
src/FingersDance.Control.Player/UserControlPlayer.xaml.cs
src/FingersDance.Control.Screen/FingersDance.Control.Screen.csproj
src/FingersDance.Control.Screen/UserControlScreen.xaml.cs
src/FingersDance.Control.SessionInput/FingersDance.Control.SessionInput.csproj
src/FingersDance.Control.SessionInput/UserControlSessionInput.xaml.cs
src/FingersDance.Control.SyncSource/FingersDance.Control.SyncSource.csproj
src/FingersDance.Control.SyncSource/UserControlSyncSource.xaml.cs
src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml
src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml.cs
src/FingersDance.Control.UserPanel/FingersDance.Control.UserPanel.csproj
src/FingersDance.Control.UserPanel/UserControlUserPanel.xaml.cs
src/FingersDance.Data/Cutting.cs
src/FingersDance.Data/FingersDance.Data.csproj
src/FingersDance.Data/Project.cs
src/FingersDance.Data/Session.cs
src/FingersDance.Data/User.cs
src/FingersDance.Debug/FingersDance.Debug.csproj
src/FingersDance.ViewModel/AnnotationViewModel.cs
src/FingersDance.ViewModel/CuttingViewModel.cs
src/FingersDance.ViewModel/FingersDance.ViewModels.csproj
src/FingersDance.ViewModel/MainViewModel.cs
src/FingersDance.ViewModel/ProjectViewModel.cs
src/FingersDance.ViewModel/SessionViewModel.cs
src/FingersDance.ViewModel/UserViewModel.cs
src/FingersDance.Views/FingersDance.Views.csproj
src/FingersDance.Views/TimelineAnnotationView.xaml
src/FingersDance.Views/TimelineAnnotationView.xaml.cs
src/FingersDance.Views/TimelineView.xaml
src/FingersDance.Views/TimelineView.xaml.cs
src/FingersDance/FingersDance.csproj
src/FingersDance/MainSurfaceWindow.xaml
src/FingersDance/MainSurfaceWindow.xaml.cs
src/FingersDance/Resources/videos.xml
--- a/src/FingersDance.ActionFactory/ActionFactory.cs	Tue Oct 13 19:09:46 2009 +0200
+++ b/src/FingersDance.ActionFactory/ActionFactory.cs	Tue Oct 13 19:33:13 2009 +0200
@@ -2,7 +2,6 @@
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
-using FingersDance.Control.Player;
 
 namespace FingersDance.ActionFactory
 {
--- a/src/FingersDance.ActionFactory/ActionGenerator.cs	Tue Oct 13 19:09:46 2009 +0200
+++ b/src/FingersDance.ActionFactory/ActionGenerator.cs	Tue Oct 13 19:33:13 2009 +0200
@@ -17,6 +17,7 @@
             actionDict.Add("ActionOpenMedia", typeof(FingersDance.Actions.ActionOpenMedia));
             actionDict.Add("ActionStopMedia", typeof(FingersDance.Actions.ActionStopMedia));
 
+            //actionDict.Add("ActionStartOrEndAnnotation", typeof(FingersDance.Actions.ActionStartOrEndAnnotation));
             actionDict.Add("ActionAddAnnotation", typeof(FingersDance.Actions.ActionAddAnnotation));
         }
 
--- a/src/FingersDance.ActionFactory/FingersDance.ActionFactory.csproj	Tue Oct 13 19:09:46 2009 +0200
+++ b/src/FingersDance.ActionFactory/FingersDance.ActionFactory.csproj	Tue Oct 13 19:33:13 2009 +0200
@@ -3,7 +3,7 @@
   <PropertyGroup>
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
     <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ProductVersion>9.0.21022</ProductVersion>
+    <ProductVersion>9.0.30729</ProductVersion>
     <SchemaVersion>2.0</SchemaVersion>
     <ProjectGuid>{C7B905EA-0678-4DA0-8EF8-7F9CBD22818E}</ProjectGuid>
     <OutputType>Library</OutputType>
@@ -30,6 +30,26 @@
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
   </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\x86\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
+    <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
+    <ErrorReport>prompt</ErrorReport>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+    <OutputPath>bin\x86\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <Optimize>true</Optimize>
+    <DebugType>pdbonly</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
+    <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
+    <ErrorReport>prompt</ErrorReport>
+  </PropertyGroup>
   <ItemGroup>
     <Reference Include="System" />
     <Reference Include="System.Core">
@@ -54,10 +74,6 @@
       <Project>{1E80D5A1-C45C-443B-8992-4A4D78D280FC}</Project>
       <Name>FingersDance.Actions</Name>
     </ProjectReference>
-    <ProjectReference Include="..\FingersDance.Control.Player\FingersDance.Control.Player.csproj">
-      <Project>{D5625AA4-362F-4E46-9916-65F3B173ECBE}</Project>
-      <Name>FingersDance.Control.Player</Name>
-    </ProjectReference>
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
--- a/src/FingersDance.Actions/ActionAddAnnotation.cs	Tue Oct 13 19:09:46 2009 +0200
+++ b/src/FingersDance.Actions/ActionAddAnnotation.cs	Tue Oct 13 19:33:13 2009 +0200
@@ -4,6 +4,7 @@
 using System.Text;
 
 using FingersDance.Control.TimeLine;
+using FingersDance.ViewModels;
 
 namespace FingersDance.Actions
 {
@@ -11,6 +12,7 @@
     {
         private string _Text = "";
         private UserControlTimeLine myTimeline;
+        private AnnotationViewModel myAnnotationViewModel;
 
         public ActionAddAnnotation()
         {
@@ -22,15 +24,16 @@
             _Text = text;
         }
 
-        public ActionAddAnnotation(UserControlTimeLine uct)
+        public ActionAddAnnotation(List<Object> args)
         {
-            myTimeline = uct;
+            myTimeline = (UserControlTimeLine)args[0];
+            myAnnotationViewModel = (AnnotationViewModel)args[1];
         }
 
         public void Execute()
         {
             if (myTimeline != null)
-                myTimeline.addAnnotation();
+                myTimeline.addAnnotation(myAnnotationViewModel);
         }
     }
 }
--- a/src/FingersDance.Actions/FingersDance.Actions.csproj	Tue Oct 13 19:09:46 2009 +0200
+++ b/src/FingersDance.Actions/FingersDance.Actions.csproj	Tue Oct 13 19:33:13 2009 +0200
@@ -39,6 +39,23 @@
     <OutputPath>.\bin\Release\</OutputPath>
     <DefineConstants>TRACE</DefineConstants>
   </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\x86\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
+    <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+    <OutputPath>bin\x86\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <Optimize>true</Optimize>
+    <PlatformTarget>x86</PlatformTarget>
+    <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
+    <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
+  </PropertyGroup>
   <ItemGroup>
     <Reference Include="System" />
     <Reference Include="System.Core">
@@ -104,6 +121,10 @@
       <Project>{2BCEE1BF-D3AC-478C-A26B-DFDB7420E965}</Project>
       <Name>FingersDance.Control.TimeLine</Name>
     </ProjectReference>
+    <ProjectReference Include="..\FingersDance.ViewModel\FingersDance.ViewModels.csproj">
+      <Project>{E81BB080-0598-43AC-90CE-54D6570C4E9E}</Project>
+      <Name>FingersDance.ViewModels</Name>
+    </ProjectReference>
   </ItemGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
 </Project>
\ No newline at end of file
--- a/src/FingersDance.Control.Close/FingersDance.Control.Close.csproj	Tue Oct 13 19:09:46 2009 +0200
+++ b/src/FingersDance.Control.Close/FingersDance.Control.Close.csproj	Tue Oct 13 19:33:13 2009 +0200
@@ -39,6 +39,23 @@
     <OutputPath>.\bin\Release\</OutputPath>
     <DefineConstants>TRACE</DefineConstants>
   </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\x86\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
+    <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+    <OutputPath>bin\x86\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <Optimize>true</Optimize>
+    <PlatformTarget>x86</PlatformTarget>
+    <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
+    <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
+  </PropertyGroup>
   <ItemGroup>
     <Reference Include="System" />
     <Reference Include="System.Core">
--- a/src/FingersDance.Control.Close/UserControlClose.xaml	Tue Oct 13 19:09:46 2009 +0200
+++ b/src/FingersDance.Control.Close/UserControlClose.xaml	Tue Oct 13 19:33:13 2009 +0200
@@ -10,7 +10,7 @@
 
 	<Grid x:Name="LayoutRoot" Background="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}">
 		<Label Margin="88.06,56.717,76.029,0" VerticalAlignment="Top" Content="Estes-vous sure de vouloir quitter ?" Height="42.363" x:Name="LabelAlert" Foreground="White"/>
-		<Custom:SurfaceButton VerticalAlignment="Bottom" Content="Oui" Margin="81.604,0,0,27.224" x:Name="SurfaceButtonOK" HorizontalAlignment="Left" Width="85.754"/>
-		<Custom:SurfaceButton HorizontalAlignment="Right" VerticalAlignment="Bottom" Content="Non" Margin="0,0,76.029,27.224" Width="85.754" x:Name="SurfaceButtonNO"/>
+		<Custom:SurfaceButton VerticalAlignment="Bottom" Content="Oui" Margin="81.604,0,0,27.224" x:Name="SurfaceButtonOK" HorizontalAlignment="Left" Width="85.754" ContactDown="SurfaceButtonOK_ContactDown" Click="SurfaceButtonOK_Click"/>
+		<Custom:SurfaceButton HorizontalAlignment="Right" VerticalAlignment="Bottom" Content="Non" Margin="0,0,76.029,27.224" Width="85.754" x:Name="SurfaceButtonNO" ContactDown="SurfaceButtonNO_ContactDown" Click="SurfaceButtonNO_Click"/>
 	</Grid>
 </UserControl>
\ No newline at end of file
--- a/src/FingersDance.Control.Close/UserControlClose.xaml.cs	Tue Oct 13 19:09:46 2009 +0200
+++ b/src/FingersDance.Control.Close/UserControlClose.xaml.cs	Tue Oct 13 19:33:13 2009 +0200
@@ -12,11 +12,52 @@
 {
 	public partial class UserControlClose
 	{
-		public UserControlClose()
+        public event EventHandler EH_SurfaceButtonClose_ContactDown;
+        public bool close;
+        public int Id = 0;
+
+		public UserControlClose(int closeid)
 		{
+            Id = closeid;
 			this.InitializeComponent();
 
 			// Insert code required on object creation below this point.
 		}
+
+        private void SurfaceButtonOK_ContactDown(object sender, Microsoft.Surface.Presentation.ContactEventArgs e)
+        {
+            if (EH_SurfaceButtonClose_ContactDown != null)
+            {
+                close = true;
+                EH_SurfaceButtonClose_ContactDown(this, new EventArgs());
+            }
+        }
+
+        private void SurfaceButtonNO_ContactDown(object sender, Microsoft.Surface.Presentation.ContactEventArgs e)
+        {
+            if (EH_SurfaceButtonClose_ContactDown != null)
+            {
+                close = false;
+                EH_SurfaceButtonClose_ContactDown(this, new EventArgs());
+            }
+        }
+
+        private void SurfaceButtonNO_Click(object sender, RoutedEventArgs e)
+        {
+            if (EH_SurfaceButtonClose_ContactDown != null)
+            {
+                close = false;
+                EH_SurfaceButtonClose_ContactDown(this, new EventArgs());
+            }
+        }
+
+        private void SurfaceButtonOK_Click(object sender, RoutedEventArgs e)
+        {
+            if (EH_SurfaceButtonClose_ContactDown != null)
+            {
+                close = true;
+                EH_SurfaceButtonClose_ContactDown(this, new EventArgs());
+            }
+        }
 	}
 }
\ No newline at end of file
--- a/src/FingersDance.Control.ListVideo/FingersDance.Control.ListVideo.csproj	Tue Oct 13 19:09:46 2009 +0200
+++ b/src/FingersDance.Control.ListVideo/FingersDance.Control.ListVideo.csproj	Tue Oct 13 19:33:13 2009 +0200
@@ -39,6 +39,23 @@
     <OutputPath>.\bin\Release\</OutputPath>
     <DefineConstants>TRACE</DefineConstants>
   </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\x86\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
+    <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+    <OutputPath>bin\x86\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <Optimize>true</Optimize>
+    <PlatformTarget>x86</PlatformTarget>
+    <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
+    <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
+  </PropertyGroup>
   <ItemGroup>
     <Reference Include="System" />
     <Reference Include="System.Core">
--- a/src/FingersDance.Control.ListVideo/UserControlListVideo.xaml.cs	Tue Oct 13 19:09:46 2009 +0200
+++ b/src/FingersDance.Control.ListVideo/UserControlListVideo.xaml.cs	Tue Oct 13 19:33:13 2009 +0200
@@ -23,6 +23,7 @@
         public event EventHandler EH_ItemVideo1_ContactDown;
 
         public string path = "";
+        public string VideoName = "";
         
         public UserControlListVideo()
         {
@@ -36,6 +37,7 @@
         private void ItemVideo_ContactTapGesture(object sender, Microsoft.Surface.Presentation.ContactEventArgs e)
         {
             path = ((CustomListBoxItem)sender).Path;
+            VideoName = path;
             if (EH_ItemVideo1_ContactDown != null)
                 EH_ItemVideo1_ContactDown(this, new EventArgs());
             
@@ -44,6 +46,7 @@
         private void ItemVideo_Click(object sender, System.Windows.RoutedEventArgs e)
         {
             path = ((CustomListBoxItem)sender).Path;
+            VideoName = path;
             if (EH_ItemVideo1_ContactDown != null)
                 EH_ItemVideo1_ContactDown(this, new EventArgs());
 
--- a/src/FingersDance.Control.Player/FingersDance.Control.Player.csproj	Tue Oct 13 19:09:46 2009 +0200
+++ b/src/FingersDance.Control.Player/FingersDance.Control.Player.csproj	Tue Oct 13 19:33:13 2009 +0200
@@ -142,10 +142,26 @@
     <Resource Include="Resources\WindowBackground.jpg" />
   </ItemGroup>
   <ItemGroup>
+    <ProjectReference Include="..\FingersDance.ActionFactory\FingersDance.ActionFactory.csproj">
+      <Project>{C7B905EA-0678-4DA0-8EF8-7F9CBD22818E}</Project>
+      <Name>FingersDance.ActionFactory</Name>
+    </ProjectReference>
     <ProjectReference Include="..\FingersDance.Actions\FingersDance.Actions.csproj">
       <Project>{1E80D5A1-C45C-443B-8992-4A4D78D280FC}</Project>
       <Name>FingersDance.Actions</Name>
     </ProjectReference>
+    <ProjectReference Include="..\FingersDance.Control.TimeLine\FingersDance.Control.TimeLine.csproj">
+      <Project>{2BCEE1BF-D3AC-478C-A26B-DFDB7420E965}</Project>
+      <Name>FingersDance.Control.TimeLine</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\FingersDance.ViewModel\FingersDance.ViewModels.csproj">
+      <Project>{E81BB080-0598-43AC-90CE-54D6570C4E9E}</Project>
+      <Name>FingersDance.ViewModels</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\FingersDance.Views\FingersDance.Views.csproj">
+      <Project>{0B308B6E-7B1E-46C0-ACC7-0B7EFC4D0B2C}</Project>
+      <Name>FingersDance.Views</Name>
+    </ProjectReference>
   </ItemGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
 </Project>
\ No newline at end of file
--- a/src/FingersDance.Control.Player/UserControlPlayer.xaml	Tue Oct 13 19:09:46 2009 +0200
+++ b/src/FingersDance.Control.Player/UserControlPlayer.xaml	Tue Oct 13 19:33:13 2009 +0200
@@ -6,7 +6,7 @@
 	mc:Ignorable="d"
 	xmlns:Custom="http://schemas.microsoft.com/surface/2008" xmlns:Microsoft_Surface_Presentation_Generic="clr-namespace:Microsoft.Surface.Presentation.Generic;assembly=Microsoft.Surface.Presentation.Generic"
 	x:Class="FingersDance.Control.Player.UserControlPlayer"
-	x:Name="UserControl"
+	x:Name="UserControl" AllowDrop="True" Custom:SurfaceDragDrop.DragOver="Play_Pause_area_DragOver" Custom:SurfaceDragDrop.DragEnter="Play_Pause_area_DragEnter" Custom:SurfaceDragDrop.DragLeave="Play_Pause_area_DragLeave" Custom:SurfaceDragDrop.Drop="Play_Pause_area_Drop"
 	Width="560" Height="400">
 	<UserControl.Resources>
 		<Storyboard x:Key="OnClick1"/>
@@ -125,20 +125,25 @@
 			</Style.BasedOn>
 		</Style>
 	</UserControl.Resources>
-        <Grid x:Name="LayoutRoot" Width="{Binding ActualWidth, ElementName=UserControl, Mode=Default}" Height="{Binding ActualHeight, ElementName=UserControl, Mode=Default}" Background="{x:Null}" >
-        	<Viewbox Margin="0,0,0,0" Width="{Binding ActualWidth, ElementName=UserControl, Mode=Default}" Height="{Binding ActualHeight, ElementName=UserControl, Mode=Default}" Stretch="Uniform">
-        		<Grid Width="560" Height="400" HorizontalAlignment="Left" x:Name="GridPlayer">
-        			<MediaElement x:Name="MediaElementVideo" MediaOpened="MediaElementVideo_MediaOpened" Stretch="Fill" ScrubbingEnabled="False" StretchDirection="Both" Margin="0,0,50,0" />
-        			<Custom:SurfaceButton x:Name="Rewind_area" Content="" ContactDown="ButtonRewind_ContactDown" Click="ButtonRewind_Click" Foreground="{x:Null}" Background="#FFFFFFFF" BorderBrush="{x:Null}" Opacity="0" Width="72" HorizontalAlignment="Left" Style="{DynamicResource FingersDance.Control.PlayerButton}" Margin="0,0,0,196"/>
-        			<Custom:SurfaceButton x:Name="Fast_Forward_area" Content="" ContactDown="ButtonFastForward_ContactDown" Click="ButtonFastForward_Click" Foreground="{x:Null}" Background="#FFFFFFFF" BorderBrush="{x:Null}" Opacity="0" Width="72" HorizontalAlignment="Right" Style="{DynamicResource FingersDance.Control.PlayerButton}" Margin="0,0,54,196"/>
-        			<Custom:SurfaceButton x:Name="Play_Pause_area" ContactDown="ButtonPlayPause_ContactDown" Click="ButtonPlayPause_Click" Foreground="{x:Null}" Background="#FFFFFFFF" BorderBrush="{x:Null}" Margin="72,0,126,196" Style="{DynamicResource FingersDance.Control.PlayerButton}" Opacity="0"/>
-        			<StackPanel Opacity="1" HorizontalAlignment="Right" Width="50" Background="#FF0046F6" x:Name="StackPanelAnnotation" VerticalAlignment="Bottom" Height="Auto">
-        				<Rectangle Width="50" Height="50" Fill="#FFFFFFFF" Stroke="#FF000000"/>
-        				<Rectangle Width="50" Height="50" Fill="#FFFFFFFF" Stroke="#FF000000"/>
-        				<Rectangle Width="50" Height="50" Fill="#FFFFFFFF" Stroke="#FF000000"/>
-        				<Rectangle Width="50" Height="50" Fill="#FFFFFFFF" Stroke="#FF000000" VerticalAlignment="Bottom"/>
-        			</StackPanel>
-        		</Grid>
-        	</Viewbox>
-        </Grid>
+    <Grid x:Name="LayoutRoot" Width="{Binding ActualWidth, ElementName=UserControl, Mode=Default}" Height="{Binding ActualHeight, ElementName=UserControl, Mode=Default}" Background="{x:Null}">
+    	<Viewbox Margin="0,0,0,0" Width="{Binding ActualWidth, ElementName=UserControl, Mode=Default}" Height="{Binding ActualHeight, ElementName=UserControl, Mode=Default}" Stretch="Uniform" AllowDrop="True">
+    		<Grid Width="560" Height="400" HorizontalAlignment="Left" x:Name="GridPlayer">
+    			<MediaElement x:Name="MediaElementVideo" MediaOpened="MediaElementVideo_MediaOpened" Stretch="Fill" ScrubbingEnabled="False" StretchDirection="Both" Margin="0,0,50,0" />
+    			<Custom:SurfaceButton x:Name="Rewind_area" Content="" ContactDown="ButtonRewind_ContactDown" 
+                                      Click="ButtonRewind_Click" Foreground="{x:Null}" Background="#FFFFFFFF" BorderBrush="{x:Null}" 
+                                      Opacity="0" Width="72" HorizontalAlignment="Left" Style="{DynamicResource FingersDance.Control.PlayerButton}" Margin="0,0,0,0"/>
+    			<Custom:SurfaceButton x:Name="Fast_Forward_area" Content="" ContactDown="ButtonFastForward_ContactDown" Click="ButtonFastForward_Click" 
+                                      Foreground="{x:Null}" Background="#FFFFFFFF" BorderBrush="{x:Null}" Opacity="0" Width="72" HorizontalAlignment="Right" 
+                                      Style="{DynamicResource FingersDance.Control.PlayerButton}" Margin="0,0,54,0"/>
+    			<Custom:SurfaceButton x:Name="Play_Pause_area" ContactDown="ButtonPlayPause_ContactDown" Click="ButtonPlayPause_Click" Foreground="{x:Null}" 
+                                      Background="#FFFFFFFF" BorderBrush="{x:Null}" Margin="72,0,126,0" Style="{DynamicResource FingersDance.Control.PlayerButton}" Opacity="0"/>
+    			<StackPanel Opacity="1" HorizontalAlignment="Right" Width="50" Background="#FF0046F6" x:Name="StackPanelAnnotation" VerticalAlignment="Bottom" Height="Auto">
+    				<Rectangle Width="50" Height="50" Fill="#FFFFFFFF" Stroke="#FF000000"/>
+    				<Rectangle Width="50" Height="50" Fill="#FFFFFFFF" Stroke="#FF000000"/>
+    				<Rectangle Width="50" Height="50" Fill="#FFFFFFFF" Stroke="#FF000000"/>
+    				<Rectangle Width="50" Height="50" Fill="#FFFFFFFF" Stroke="#FF000000" VerticalAlignment="Bottom"/>
+    			</StackPanel>
+    		</Grid>
+    	</Viewbox>
+    </Grid>
  </UserControl>
\ No newline at end of file
--- a/src/FingersDance.Control.Player/UserControlPlayer.xaml.cs	Tue Oct 13 19:09:46 2009 +0200
+++ b/src/FingersDance.Control.Player/UserControlPlayer.xaml.cs	Tue Oct 13 19:33:13 2009 +0200
@@ -10,6 +10,15 @@
 using System.Windows.Navigation;
 using System.ComponentModel;
 using System.Reflection;
+using System.Collections.Generic;
+
+using Microsoft.Surface.Presentation;
+using Microsoft.Surface.Presentation.Controls;
+using FingersDance.ActionFactory;
+using FingersDance.Actions;
+using FingersDance.Control.TimeLine;
+using FingersDance.Views;
+using FingersDance.ViewModels;
 
 namespace FingersDance.Control.Player
 {
@@ -171,5 +180,78 @@
             if(PlayerOpened!=null)
                 PlayerOpened(this, new EventArgs());
         }
+
+        private void Play_Pause_area_DragEnter(object sender, SurfaceDragDropEventArgs e)
+        {
+            //Console.WriteLine("Enter");
+
+            // If the TimelineAnnotationView comes from a user control different from the current one, 
+            // it means that we want to add the annotation to the current list.
+            // So we check if the dragged annotation can be dragged or if it will recover any existant annotation (in this case it will not be accepted)
+            // e.Cursor.DragSource is the SurfaceListBox where the drag started from
+            SurfaceListBox slb = (SurfaceListBox)e.Cursor.DragSource;
+            // We get the instance of the UserControlSyncSource
+            UserControl syncSrc = (UserControl)((Grid)((Grid)this.Parent).Parent).Parent;
+            // and its UserControlTimeline
+            UserControlTimeLine tl = (UserControlTimeLine)((Grid)((Grid)syncSrc.Content).Children[0]).Children[0];
+            if (((Grid)((UserControl)((Grid)slb.Parent).Parent).Parent).Parent != tl)
+            {
+                // e.Cursor.Visual is the ContentControl, so its Content is the dragged TimelineAnnotationView
+                AnnotationViewModel annotationDataVM = (AnnotationViewModel)((TimelineAnnotationView)((ContentControl)e.Cursor.Visual).Content).DataContext;
+                Play_Pause_area.Background = tl.isAnnotationAccepted(annotationDataVM) ? new SolidColorBrush(Colors.Green) : new SolidColorBrush(Colors.Red);
+            }
+            else
+            {
+                Play_Pause_area.Background = new SolidColorBrush(Colors.White);
+            }
+            Play_Pause_area.Opacity = 0.3;
+
+        }
+
+        private void Play_Pause_area_DragLeave(object sender, SurfaceDragDropEventArgs e)
+        {
+            //Console.WriteLine("Leave");
+            Play_Pause_area.Opacity = 0;
+        }
+
+        private void Play_Pause_area_DragOver(object sender, SurfaceDragDropEventArgs e)
+        {
+            //Console.WriteLine("Over");
+        }
+
+        private void Play_Pause_area_Drop(object sender, SurfaceDragDropEventArgs e)
+        {
+            //Console.WriteLine("Drop");
+            Play_Pause_area.Opacity = 0;
+            // e.Cursor.Visual is the ContentControl, so its Content is the dragged TimelineAnnotationView
+            AnnotationViewModel annotationDataVM = (AnnotationViewModel)((TimelineAnnotationView)((ContentControl)e.Cursor.Visual).Content).DataContext;
+            int nbSeconds = (int)annotationDataVM.TcBegin;
+            int nbMilliSec = (int)((annotationDataVM.TcBegin * 1000)%1000);
+            MediaElementVideo.Position = new TimeSpan(0, 0, 0, nbSeconds, nbMilliSec);
+
+
+            // If the TimelineAnnotationView comes from a user control different from the current one, 
+            // it means that we want to add the annotation to the current list.
+            // So we generate the ActionAddAnnotation
+            // e.Cursor.DragSource is the SurfaceListBox where the drag started from
+            SurfaceListBox slb = (SurfaceListBox)e.Cursor.DragSource;
+            // We get the instance of the UserControlSyncSource
+            UserControl syncSrc = (UserControl)((Grid)((Grid)this.Parent).Parent).Parent;
+            // and its UserControlTimeline
+            UserControl tl = (UserControl)((Grid)((Grid)syncSrc.Content).Children[0]).Children[0];
+            if (((Grid)((UserControl)((Grid)slb.Parent).Parent).Parent).Parent != tl)
+            {
+                // Now we build the action arguments : a list holding the timeline and the annotation view models
+                List<Object> actionsArgs = new List<Object>();
+                actionsArgs.Add(tl);
+                actionsArgs.Add(annotationDataVM);
+
+                ActionGenerator ag = new ActionGenerator();
+                ActionBase ab = ag.GetAction("ActionAddAnnotation", actionsArgs);
+                if (ab != null)
+                    ab.Execute();
+            }
+
+        }
 	}
 }
\ No newline at end of file
--- a/src/FingersDance.Control.Screen/FingersDance.Control.Screen.csproj	Tue Oct 13 19:09:46 2009 +0200
+++ b/src/FingersDance.Control.Screen/FingersDance.Control.Screen.csproj	Tue Oct 13 19:33:13 2009 +0200
@@ -135,6 +135,14 @@
       <Project>{E6A3A067-1CB4-43D2-BB9C-DC72361F7E22}</Project>
       <Name>FingersDance.Control.UserPanel</Name>
     </ProjectReference>
+    <ProjectReference Include="..\FingersDance.Data\FingersDance.Data.csproj">
+      <Project>{EAF384DB-2AE4-4132-839D-60F9DAFDEAD8}</Project>
+      <Name>FingersDance.Data</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\FingersDance.ViewModel\FingersDance.ViewModels.csproj">
+      <Project>{E81BB080-0598-43AC-90CE-54D6570C4E9E}</Project>
+      <Name>FingersDance.ViewModels</Name>
+    </ProjectReference>
   </ItemGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
 </Project>
\ No newline at end of file
--- a/src/FingersDance.Control.Screen/UserControlScreen.xaml.cs	Tue Oct 13 19:09:46 2009 +0200
+++ b/src/FingersDance.Control.Screen/UserControlScreen.xaml.cs	Tue Oct 13 19:33:13 2009 +0200
@@ -9,30 +9,40 @@
 using System.Windows.Navigation;
 using FingersDance.Control.ListVideo;
 using FingersDance.Control.SessionInput;
+using FingersDance.ViewModels;
+using FingersDance.Data;
 
 namespace FingersDance.Control.Screen
 {
 	public partial class UserControlScreen
 	{
         public String contexteGrid;
-        public string Path = "";
         public int id = 0;
         public event EventHandler UC_Screen_NewSession;
+        public MainViewModel MainViewModel;
+        public User User = new User();
 
-		public UserControlScreen(int id)
-		{
-			this.InitializeComponent();
+        public UserControlScreen(int id, MainViewModel mvmodel)
+        {
+            this.InitializeComponent();
             this.id = id;
-            //1-Creation de la ListVideo
-            UserControlListVideo ListVideo = new UserControlListVideo();
-            ListVideo.Name = "ListVideo1";
+            MainViewModel = mvmodel;
+
+            if (MainViewModel.Session.VideoPath.Equals(""))
+            {
+                //1-Creation de la ListVideo
+                UserControlListVideo ListVideo = new UserControlListVideo();
+                ListVideo.Name = "ListVideo1";
 
-            //2-Ajout de la ListVideo au ControlScreen
-            this.AddToGrid(ListVideo);
+                //2-Ajout de la ListVideo au ControlScreen
+                this.AddToGrid(ListVideo);
 
-            //3-Creation des Events pour chaque item de la video
-            ListVideo.EH_ItemVideo1_ContactDown += new System.EventHandler(this.ListVideo_EH_ItemVideo_ContactDown);
-		}
+                //3-Creation des Events pour chaque item de la video
+                ListVideo.EH_ItemVideo1_ContactDown += new System.EventHandler(this.ListVideo_EH_ItemVideo_ContactDown);
+            }
+            else
+                ListVideo_EH_ItemVideo_ContactDown(null, null);
+        }
 
         //Rajout un UIElement vers la grid du screen.
         public void AddToGrid(UIElement uie)
@@ -46,12 +56,6 @@
 
         private void ListVideo_EH_ItemVideo_ContactDown(object sender, EventArgs e)
         {
-
-            //Creation d'un ScatterView Item
-            //ScatterViewItem scatterViewItemSessionInput = new ScatterViewItem();
-            //scatterViewItemSessionInput.Name = "ScatterViewItemSessionInput";
-
-
             //1-Creation d'une nouvelle seance.                
             UserControlSessionInput SessionInput = new UserControlSessionInput();
             SessionInput.Name = "SessionInput";
@@ -63,27 +67,24 @@
                 LayoutRoot.Children.Add(SessionInput);
 
                 //2.5 rensegner la video choisie au screen
-                this.Path = ((UserControlListVideo)sender).path;
+                if (sender != null)
+                    MainViewModel.CreateSession(((UserControlListVideo)sender).VideoName, ((UserControlListVideo)sender).path);
+
                 //3-Creation des Events
                 SessionInput.EH_SurfaceButtonSubmit_ContactDown += new System.EventHandler(this.SessionInput_EH_SurfaceButtonSubmit_ContactDown);
                 //4-Supression du UC List Video
                 LayoutRoot.Children.Remove((UserControlListVideo)sender);
-
-                //Init Scatter View Properties and Add it to the scatter view.
-                /*scatterViewItemSessionInput.Content = SessionInput;
-                scatterViewItemSessionInput.CanMove = true;
-                scatterViewItemSessionInput.CanScale = false;
-                scatterViewItemSessionInput.CanRotate = true;
-                scatterViewItemSessionInput.Center = new Point((double)actualGrid.ActualWidth,(double)actualGrid.ActualHeight);
-                scaterview.Items.Add(scatterViewItemSessionInput);*/
             }
             catch (Exception ex) { }
         }
-
+        
         private void SessionInput_EH_SurfaceButtonSubmit_ContactDown(object sender, EventArgs e)
         {
             try
             {
+                //1-Creation du projet
+                User = ((UserControlSessionInput)sender).User;
+                MainViewModel.CreateProject(User);
                 //2-Suppression UCSession Input
                 LayoutRoot.Children.Remove((UserControlSessionInput)sender);
                 //3-Suppression du UC Screen
--- a/src/FingersDance.Control.SessionInput/FingersDance.Control.SessionInput.csproj	Tue Oct 13 19:09:46 2009 +0200
+++ b/src/FingersDance.Control.SessionInput/FingersDance.Control.SessionInput.csproj	Tue Oct 13 19:33:13 2009 +0200
@@ -40,6 +40,23 @@
     <OutputPath>.\bin\Release\</OutputPath>
     <DefineConstants>TRACE</DefineConstants>
   </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\x86\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
+    <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+    <OutputPath>bin\x86\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <Optimize>true</Optimize>
+    <PlatformTarget>x86</PlatformTarget>
+    <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
+    <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
+  </PropertyGroup>
   <ItemGroup>
     <Reference Include="System" />
     <Reference Include="System.Core">
@@ -107,5 +124,11 @@
     <Resource Include="fingersDance.Control.SessionInput.ressources_Files\**\*.jpg;fingersDance.Control.SessionInput.ressources_Files\**\*.jpeg;fingersDance.Control.SessionInput.ressources_Files\**\*.png;fingersDance.Control.SessionInput.ressources_Files\**\*.bmp;fingersDance.Control.SessionInput.ressources_Files\**\*.gif;fingersDance.Control.SessionInput.ressources_Files\**\*.tif;fingersDance.Control.SessionInput.ressources_Files\**\*.tiff" />
     <Resource Include="Resources\WindowBackground.jpg" />
   </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\FingersDance.Data\FingersDance.Data.csproj">
+      <Project>{EAF384DB-2AE4-4132-839D-60F9DAFDEAD8}</Project>
+      <Name>FingersDance.Data</Name>
+    </ProjectReference>
+  </ItemGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
 </Project>
\ No newline at end of file
--- a/src/FingersDance.Control.SessionInput/UserControlSessionInput.xaml.cs	Tue Oct 13 19:09:46 2009 +0200
+++ b/src/FingersDance.Control.SessionInput/UserControlSessionInput.xaml.cs	Tue Oct 13 19:33:13 2009 +0200
@@ -7,30 +7,39 @@
 using System.Windows.Media;
 using System.Windows.Media.Animation;
 using System.Windows.Navigation;
+using FingersDance.Data;
 
 namespace FingersDance.Control.SessionInput
 {
 	public partial class UserControlSessionInput
 	{
         public event EventHandler EH_SurfaceButtonSubmit_ContactDown;
+        public User User = new User();
 
 		public UserControlSessionInput()
 		{
 			this.InitializeComponent();
-
-			// Insert code required on object creation below this point.
+            ST_Date.Text = DateTime.Now.Day.ToString() + "/" + DateTime.Now.Month.ToString() + "/" + DateTime.Now.Year.ToString();
 		}
 
         private void SurfaceButtonSubmit_ContactDown(object sender, Microsoft.Surface.Presentation.ContactEventArgs e)
         {
-            if (EH_SurfaceButtonSubmit_ContactDown != null)
-                EH_SurfaceButtonSubmit_ContactDown(this, new EventArgs());
+            if (!ST_Alias.Text.Equals("") && !ST_Date.Text.Equals("") && !ST_Email.Text.Equals("") && !ST_Name.Text.Equals(""))
+            {
+                User = new User(ST_Name.Text, ST_Email.Text, ST_Alias.Text);
+                if (EH_SurfaceButtonSubmit_ContactDown != null)
+                    EH_SurfaceButtonSubmit_ContactDown(this, new EventArgs());
+            }
         }
 
         private void SurfaceButtonSubmit_Click(object sender, RoutedEventArgs e)
         {
-            if (EH_SurfaceButtonSubmit_ContactDown != null)
-                EH_SurfaceButtonSubmit_ContactDown(this, new EventArgs());
+            if (!ST_Alias.Text.Equals("") && !ST_Date.Text.Equals("") && !ST_Email.Text.Equals("") && !ST_Name.Text.Equals(""))
+            {
+                User = new User(ST_Name.Text, ST_Email.Text, ST_Alias.Text);
+                if (EH_SurfaceButtonSubmit_ContactDown != null)
+                    EH_SurfaceButtonSubmit_ContactDown(this, new EventArgs());
+            }
         }
 
 	}
--- a/src/FingersDance.Control.SyncSource/FingersDance.Control.SyncSource.csproj	Tue Oct 13 19:09:46 2009 +0200
+++ b/src/FingersDance.Control.SyncSource/FingersDance.Control.SyncSource.csproj	Tue Oct 13 19:33:13 2009 +0200
@@ -39,6 +39,23 @@
     <OutputPath>.\bin\Release\</OutputPath>
     <DefineConstants>TRACE</DefineConstants>
   </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\x86\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
+    <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+    <OutputPath>bin\x86\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <Optimize>true</Optimize>
+    <PlatformTarget>x86</PlatformTarget>
+    <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
+    <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
+  </PropertyGroup>
   <ItemGroup>
     <Reference Include="System" />
     <Reference Include="System.Core">
--- a/src/FingersDance.Control.SyncSource/UserControlSyncSource.xaml.cs	Tue Oct 13 19:09:46 2009 +0200
+++ b/src/FingersDance.Control.SyncSource/UserControlSyncSource.xaml.cs	Tue Oct 13 19:33:13 2009 +0200
@@ -23,6 +23,7 @@
         public void Load(string path)
         {
             this.UserControlPlayer.initPlayer(path);
+            this.UserControlPlayer.playerPlay();
         }
 
         #region player
--- a/src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml	Tue Oct 13 19:09:46 2009 +0200
+++ b/src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml	Tue Oct 13 19:33:13 2009 +0200
@@ -780,6 +780,6 @@
 	<Grid x:Name="LayoutRoot" Width="Auto" Height="Auto" Background="{x:Null}">
 		<Custom:SurfaceSlider  Height="Auto" x:Name="slider" Value="0.5" Width="Auto" 
                                Thumb.DragStarted="sliderPosition_DragStarted" Thumb.DragCompleted="sliderPosition_DragCompleted" ContactTapGesture="slider_ContactTapGesture" Background="#19FFFFFF" Style="{DynamicResource FingersDance.Control.Slider}" />
-        <vw:TimelineView x:Name="tv" Margin="0,30,0,0" Width="{Binding Path=ActualWidth, ElementName=slider, Mode=Default}" Background="{x:Null}"/>
+        <vw:TimelineView x:Name="tv" Margin="0,15,0,0" Background="{x:Null}"/>
     </Grid>
 </UserControl>
\ No newline at end of file
--- a/src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml.cs	Tue Oct 13 19:09:46 2009 +0200
+++ b/src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml.cs	Tue Oct 13 19:33:13 2009 +0200
@@ -5,15 +5,18 @@
 using System.Windows;
 using System.Windows.Controls;
 using System.Windows.Data;
+using System.Windows.Input;
 using System.Windows.Media;
 using System.Windows.Media.Animation;
 using System.Windows.Navigation;
 using System.Windows.Controls.Primitives;
 using Microsoft.Surface.Presentation.Controls;
+using Microsoft.Surface.Presentation;
 using System.Windows.Threading;
 
 using FingersDance.Data;
 using FingersDance.ViewModels;
+using FingersDance.Views;
 
 namespace FingersDance.Control.TimeLine
 {
@@ -32,9 +35,11 @@
 
         private double totalmilliseconds;
 
-        private List<Annotation> annotList = new List<Annotation>();
-        private float annotWidth = 40+1;
-        private CuttingViewModel cutvm;
+        private List<Annotation> AnnotList = new List<Annotation>();
+        private float AnnotWidth = 300 + 15; // The surfaceListBox adds 15 pixels between each item
+        private CuttingViewModel CuttingVM;
+        private Boolean AnnotWaiting = false;
+        private float AnnotTcBegin;
 
         #region Properties
 
@@ -91,7 +96,7 @@
 
         
 		public UserControlTimeLine()
-		{   
+		{
 			this.InitializeComponent();
 
 			// Insert code required on object creation below this point.
@@ -106,31 +111,33 @@
             this.SizeChanged += new SizeChangedEventHandler(UserControlTimeLine_SizeChanged);
 
             // TEMP FOR DATA BINDING
-            annotList = new List<Annotation>();
-            annotList.Add(new Annotation(0, 10, "Axe Cam 1"));
-            //annotList.Add(new Annotation(20 - (1 * annotWidth), 30, "Mvt Cam 2"));
-            //annotList.Add(new Annotation(50 - (2 * annotWidth), 60, "Saut 3"));
-            //annotList.Add(new Annotation(100 - (3 * annotWidth), 20, "Saut 4"));
-            //annotList.Add(new Annotation(120 - (4 * annotWidth), 50, "Saut 5"));
-            Cutting cut = new Cutting("titre de cutting", annotList);
-            cutvm = new CuttingViewModel(cut);
-            tv.DataContext = cutvm;
+            AnnotList = new List<Annotation>();
+            AnnotList.Add(new Annotation(0, 10, "Axe Cam 1"));
+            //AnnotList.Add(new Annotation(100 - (1 * AnnotWidth), 70, "Mvt Cam 2"));
+            //AnnotList.Add(new Annotation(200 - (2 * AnnotWidth), 50, "Saut 3"));
+            //AnnotList.Add(new Annotation(100 - (3 * AnnotWidth), 20, "Saut 4"));
+            //AnnotList.Add(new Annotation(120 - (4 * AnnotWidth), 50, "Saut 5"));
+            Cutting cut = new Cutting("titre de cutting", AnnotList);
+            CuttingVM = new CuttingViewModel(cut, AnnotWidth);
+            tv.DataContext = CuttingVM;
 
-            slider_ContactTapGesture(this,null);
-            /*
-            cutvm.AnnotList.Add(new AnnotationViewModel(new Annotation(180 - (5 * annotWidth), 10, "6")));
-            tv.DataContext = null;
-            tv.DataContext = cutvm;
-            */
+            tv.listview.PreviewContactDown += listview_PreviewContactDown;
+            SurfaceDragDrop.AddDragCanceledHandler(tv.listview, onDragCanceled);
+
+            UserControlTimeLine_SizeChanged(null, null);
+
+            slider_ContactTapGesture(this, null);
+            
+
         }
 
         void UserControlTimeLine_SizeChanged(object sender, SizeChangedEventArgs e)
         {
             // When scaleX = 1, 1 second = 1 pixel. To calculate the new scale, we take the real width in account.
-            Double futurScale = this.ActualWidth / (totalmilliseconds / 1000);
-            //Double futurScale = this.ActualWidth / ((totalmilliseconds<30000) ? (totalmilliseconds/10) : (totalmilliseconds / 1000)); // TEMP
+            Double futurScale = (this.ActualWidth-30) / (totalmilliseconds / 1000);
+            //Double futurScale = this.ActualWidth / ((totalmilliseconds<30000) ? (totalmilliseconds/10) : (totalmilliseconds / 1000)); // TEMP FOR SHORT CONTENTS
             tv.RenderTransform = new ScaleTransform(futurScale,1);
-            Console.WriteLine("futurScale = " + futurScale);
+            //Console.WriteLine("futurScale = " + futurScale);
             
         }
 
@@ -172,8 +179,7 @@
 
         #endregion
 
-        private void sliderPosition_DragStarted(
-            object sender, DragStartedEventArgs e)
+        private void sliderPosition_DragStarted(object sender, DragStartedEventArgs e)
         {
             isDragging = true;
             OnDragStarted();
@@ -185,8 +191,7 @@
                 DragStarted(this, new EventArgs());
         }
 
-        private void sliderPosition_DragCompleted(
-            object sender, DragCompletedEventArgs e)
+        private void sliderPosition_DragCompleted(object sender, DragCompletedEventArgs e)
         {
             finishedDragging = true;
             OnDragCompleted();
@@ -199,20 +204,227 @@
 
         private void slider_ContactTapGesture(object sender, Microsoft.Surface.Presentation.ContactEventArgs e)
         {
-            //addAnnotation();
+            //startOrEndAnnotation();
+        }
+
+        public Boolean isAnnotationAccepted(AnnotationViewModel avm)
+        {
+            Boolean annotOk = true;
+            // We check if the annotation's begin and end timecodes allow a new annotation creation
+            if (CuttingVM != null && AnnotWaiting == false)
+            {
+                foreach (Annotation a in AnnotList)
+                {
+                    //Console.WriteLine("a.TcBegin = " + a.TcBegin + ", avm.TcBegin = " + avm.TcBegin + ", tcOut = " + (a.TcBegin + a.Dur));
+                    // Check begin TC
+                    if (a.TcBegin <= avm.TcBegin && avm.TcBegin <= (a.TcBegin + a.Dur))
+                    {
+                        annotOk = false;
+                    }
+                    // Check end tc and if the new annotation will not cover any other
+                    float endTC = avm.TcBegin + avm.Dur;
+                    //Console.WriteLine("a.TcBegin = " + a.TcBegin + ", tcOut = " + (a.TcBegin + a.Dur) + ", AnnotTcBegin = " + AnnotTcBegin + ", currentTC = " + currentTC);
+                    if (a.TcBegin <= endTC && endTC <= (a.TcBegin + a.Dur) || (avm.TcBegin < a.TcBegin && (a.TcBegin + a.Dur) < endTC))
+                    {
+                        annotOk = false;
+                    }
+                }
+            }
+            else
+            {
+                annotOk = false;
+            }
+            return annotOk;
+
         }
 
-        public void addAnnotation()
+        public void addAnnotation(AnnotationViewModel avm)
         {
-            if (cutvm!=null)
+            //Console.WriteLine("addAnnotation = " + avm.TcBegin + ", " + avm.Dur + ", " + avm.GestureType);
+            Boolean annotOk = true;
+            // We check if the annotation's begin and end timecodes allow a new annotation creation
+            if (CuttingVM != null && AnnotWaiting == false)
+            {
+                foreach (Annotation a in AnnotList)
+                {
+                    //Console.WriteLine("a.TcBegin = " + a.TcBegin + ", avm.TcBegin = " + avm.TcBegin + ", tcOut = " + (a.TcBegin + a.Dur));
+                    // Check begin TC
+                    if (a.TcBegin <= avm.TcBegin && avm.TcBegin <= (a.TcBegin + a.Dur))
+                    {
+                        annotOk = false;
+                    }
+                    // Check end tc and if the new annotation will not cover any other
+                    float endTC = avm.TcBegin + avm.Dur;
+                    //Console.WriteLine("a.TcBegin = " + a.TcBegin + ", tcOut = " + (a.TcBegin + a.Dur) + ", AnnotTcBegin = " + AnnotTcBegin + ", currentTC = " + currentTC);
+                    if (a.TcBegin <= endTC && endTC <= (a.TcBegin + a.Dur) || (avm.TcBegin < a.TcBegin && (a.TcBegin + a.Dur) < endTC))
+                    {
+                        annotOk = false;
+                    }
+                }
+                // If everything's fine, we create the new one
+                if (annotOk == true)
+                {
+                    AnnotList.Add(new Annotation(avm.TcBegin, avm.Dur, avm.GestureType));
+                    CuttingVM.setListFromAnnotations(AnnotList, AnnotWidth);
+                    tv.DataContext = null;
+                    tv.DataContext = CuttingVM;
+                    AnnotWaiting = false;
+                }
+
+            }
+
+        }
+
+        public void startOrEndAnnotation()
+        {
+            Boolean annotOk = true;
+            // We open a new annotation
+            if (CuttingVM != null && AnnotWaiting == false)
             {
-                float currentTimecode = (float)slider.Value / 1000;
-                cutvm.AnnotList.Add(new AnnotationViewModel(new Annotation(currentTimecode - (cutvm.AnnotList.Count * annotWidth), 10, cutvm.AnnotList.Count.ToString())));
-                Console.WriteLine("currentTimecode = " + currentTimecode + ", nb = " + cutvm.AnnotList.Count + ", res = " + (currentTimecode - (cutvm.AnnotList.Count * annotWidth)));
-                tv.DataContext = null;
-                tv.DataContext = cutvm;
+                AnnotTcBegin = (float)slider.Value / 1000;
+
+                // First we check if the new annotation will not cover any
+                foreach (Annotation a in AnnotList)
+                {
+                    //Console.WriteLine("a.TcBegin = " + a.TcBegin + ", AnnotTcBegin = " + AnnotTcBegin + ", tcOut = " + (a.TcBegin + a.Dur));
+                    if (a.TcBegin <= AnnotTcBegin && AnnotTcBegin <= (a.TcBegin + a.Dur))
+                    {
+                        annotOk = false;
+                    }
+                }
+                // if not, we mark the beginning
+                if (annotOk == true)
+                {
+                    AnnotList.Add(new Annotation(AnnotTcBegin, 0, AnnotList.Count.ToString()));
+                    CuttingVM.setListFromAnnotations(AnnotList, AnnotWidth);
+                    //Console.WriteLine("BEGIN currentTimecode = " + AnnotTcBegin + ", nb = " + AnnotList.Count + ", res = " + (AnnotTcBegin - (AnnotList.Count * AnnotWidth)));
+                    tv.DataContext = null;
+                    tv.DataContext = CuttingVM;
+                    AnnotWaiting = true;
+                }
+            }
+            // We close the current opened annotation...
+            else if (CuttingVM != null && AnnotWaiting == true && (((float)slider.Value/1000)>AnnotTcBegin))
+            {
+                // ... by setting setting the good beginning and the good duration
+                float currentTC = (float)slider.Value / 1000;
+                float currentDuration = currentTC - AnnotTcBegin;
+
+                // First we check if the new annotation will not cover any (AnnotTcBegin was already checked)
+                foreach (Annotation a in AnnotList)
+                {
+                    //Console.WriteLine("a.TcBegin = " + a.TcBegin + ", tcOut = " + (a.TcBegin + a.Dur) + ", AnnotTcBegin = " + AnnotTcBegin + ", currentTC = " + currentTC);
+                    if (a.TcBegin <= currentTC && currentTC <= (a.TcBegin + a.Dur) || (AnnotTcBegin < a.TcBegin && (a.TcBegin + a.Dur) < currentTC))
+                    {
+                        annotOk = false;
+                    }
+                }
+
+                if (annotOk == true)
+                {
+                    AnnotList.RemoveAt(AnnotList.Count - 1);
+                    AnnotList.Add(new Annotation(AnnotTcBegin, currentDuration, AnnotList.Count.ToString()));
+                    CuttingVM.setListFromAnnotations(AnnotList, AnnotWidth);
+                    //Console.WriteLine("currentTimecode = " + AnnotTcBegin + ", curDur = " + currentDuration + ", nb = " + AnnotList.Count + ", res = " + (AnnotTcBegin - (AnnotList.Count * AnnotWidth)));
+                    tv.DataContext = null;
+                    tv.DataContext = CuttingVM;
+                    AnnotWaiting = false;
+                }
             }
         }
 
+
+        private void listview_PreviewContactDown(object sender, Microsoft.Surface.Presentation.ContactEventArgs e)
+        {
+            FrameworkElement findSource = e.OriginalSource as FrameworkElement;
+            SurfaceListBoxItem draggedElement = null;
+
+            // Find the touched SurfaceListBoxItem object.
+            while (draggedElement == null && findSource != null)
+            {
+                if ((draggedElement = findSource as SurfaceListBoxItem) == null)
+                {
+                    findSource = VisualTreeHelper.GetParent(findSource) as FrameworkElement;
+                }
+            }
+
+            if (draggedElement == null)
+            {
+                return;
+            }
+
+            // Create the cursor visual.
+            ContentControl cursorVisual = new ContentControl()
+            {
+                Content = new TimelineAnnotationView()
+                {
+                    DataContext = findSource.DataContext
+                }
+            };
+
+            // We apply the current scale to the dragged annotation
+            ((TimelineAnnotationView)cursorVisual.Content).RenderTransform = this.RenderTransform;
+
+            // Add a handler. This will enable the application to change the visual cues. (NOT USEFUL IN FINGERSDANCE CASE)
+            //SurfaceDragDrop.AddTargetChangedHandler(cursorVisual, OnTargetChanged);
+
+            // Create a list of input devices. Add the contacts that
+            // are currently captured within the dragged element and
+            // the current contact (if it isn't already in the list).
+            List<InputDevice> devices = new List<InputDevice>();
+            devices.Add(e.Contact);
+            foreach (Contact contact in draggedElement.ContactsCapturedWithin)
+            {
+                if (contact != e.Contact)
+                {
+                    devices.Add(contact);
+                }
+            }
+
+            // Get the drag source object
+            ItemsControl dragSource = ItemsControl.ItemsControlFromItemContainer(draggedElement);
+
+            bool startDragOkay =
+                SurfaceDragDrop.BeginDragDrop(
+                  dragSource,                 // The SurfaceListBox object that the cursor is dragged out from.
+                  draggedElement,             // The SurfaceListBoxItem object that is dragged from the drag source.
+                  cursorVisual,               // The visual element of the cursor.
+                  draggedElement.DataContext, // The data associated with the cursor.
+                  devices,                    // The input devices that start dragging the cursor.
+                  DragDropEffects.Move);      // The allowed drag-and-drop effects of the operation.
+
+            // If the drag began successfully, set e.Handled to true. 
+            // Otherwise SurfaceListBoxItem captures the contact 
+            // and causes the drag operation to fail.
+            e.Handled = startDragOkay;
+        }
+
+        private void onDragCanceled(Object sender, SurfaceDragDropEventArgs e)
+        {
+            Console.WriteLine("onDragCanceled = " + sender + ", ((ContentControl)e.Cursor.Visual).Content = " + ((ContentControl)e.Cursor.Visual).Content);
+            // e.Cursor.Visual is the ContentControl, so its Content is the dragged TimelineAnnotationView
+            AnnotationViewModel annotationDataVM = (AnnotationViewModel)((TimelineAnnotationView)((ContentControl)e.Cursor.Visual).Content).DataContext;
+            // We check if the annotation is well one of the current annotations
+            if (CuttingVM != null)
+            {
+                foreach (Annotation a in AnnotList)
+                {
+                    //Console.WriteLine("a.TcBegin = " + a.TcBegin + ", avm.TcBegin = " + avm.TcBegin + ", tcOut = " + (a.TcBegin + a.Dur));
+                    // Check begin TC
+                    if (a.TcBegin == annotationDataVM.TcBegin && a.Dur == annotationDataVM.Dur && a.GestureType==annotationDataVM.GestureType)
+                    {
+                        // We found the good annotation so we can delete it
+                        AnnotList.Remove(a);
+                        // We redisplay the timeline
+                        CuttingVM.setListFromAnnotations(AnnotList, AnnotWidth);
+                        tv.DataContext = null;
+                        tv.DataContext = CuttingVM;
+                        return;
+                    }
+                }
+            }
+        }
+
+
 	}
 }
\ No newline at end of file
--- a/src/FingersDance.Control.UserPanel/FingersDance.Control.UserPanel.csproj	Tue Oct 13 19:09:46 2009 +0200
+++ b/src/FingersDance.Control.UserPanel/FingersDance.Control.UserPanel.csproj	Tue Oct 13 19:33:13 2009 +0200
@@ -136,6 +136,14 @@
       <Project>{BE5AD2E7-8BC2-414A-AB92-34E4D7357740}</Project>
       <Name>FingersDance.Control.SyncSource</Name>
     </ProjectReference>
+    <ProjectReference Include="..\FingersDance.Data\FingersDance.Data.csproj">
+      <Project>{EAF384DB-2AE4-4132-839D-60F9DAFDEAD8}</Project>
+      <Name>FingersDance.Data</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\FingersDance.ViewModel\FingersDance.ViewModels.csproj">
+      <Project>{E81BB080-0598-43AC-90CE-54D6570C4E9E}</Project>
+      <Name>FingersDance.ViewModels</Name>
+    </ProjectReference>
   </ItemGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
 </Project>
\ No newline at end of file
--- a/src/FingersDance.Control.UserPanel/UserControlUserPanel.xaml.cs	Tue Oct 13 19:09:46 2009 +0200
+++ b/src/FingersDance.Control.UserPanel/UserControlUserPanel.xaml.cs	Tue Oct 13 19:33:13 2009 +0200
@@ -7,11 +7,21 @@
 using System.Windows.Media;
 using System.Windows.Media.Animation;
 using System.Windows.Navigation;
+using FingersDance.Data;
 
 namespace FingersDance.Control.UserPanel
 {
 	public partial class UserControlUserPanel
 	{
+       // public int id = 0;
+        Project _Project = new Project();
+
+        public Project Project
+        {
+            get { return _Project; }
+            set { _Project = value; }
+        }
+
 		public UserControlUserPanel()
 		{
 			this.InitializeComponent();
@@ -19,12 +29,11 @@
 			// Insert code required on object creation below this point.
 		}
 
-        public UserControlUserPanel(string path)
+        public UserControlUserPanel(Project p, string path)
         {
             this.InitializeComponent();
-
+            _Project = p;
             this.UserControlSyncSource.Load(path);
-            // Insert code required on object creation below this point.
         }
 	}
 }
\ No newline at end of file
--- a/src/FingersDance.Data/Cutting.cs	Tue Oct 13 19:09:46 2009 +0200
+++ b/src/FingersDance.Data/Cutting.cs	Tue Oct 13 19:33:13 2009 +0200
@@ -16,6 +16,8 @@
             this._annotList = annotListPar;
             
         }
+        public Cutting()
+        {}
 
         public String Title
         {
--- a/src/FingersDance.Data/FingersDance.Data.csproj	Tue Oct 13 19:09:46 2009 +0200
+++ b/src/FingersDance.Data/FingersDance.Data.csproj	Tue Oct 13 19:33:13 2009 +0200
@@ -32,6 +32,26 @@
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
   </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\x86\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
+    <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
+    <ErrorReport>prompt</ErrorReport>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+    <OutputPath>bin\x86\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <Optimize>true</Optimize>
+    <DebugType>pdbonly</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
+    <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
+    <ErrorReport>prompt</ErrorReport>
+  </PropertyGroup>
   <ItemGroup>
     <Reference Include="System" />
     <Reference Include="System.Core">
@@ -52,6 +72,7 @@
   <ItemGroup>
     <Compile Include="Annotation.cs" />
     <Compile Include="Cutting.cs" />
+    <Compile Include="Project.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
     <EmbeddedResource Include="Properties\Resources.resx">
       <Generator>ResXFileCodeGenerator</Generator>
@@ -71,6 +92,7 @@
       <DependentUpon>Settings.settings</DependentUpon>
       <DesignTimeSharedInput>True</DesignTimeSharedInput>
     </Compile>
+    <Compile Include="Session.cs" />
     <Compile Include="User.cs" />
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/FingersDance.Data/Project.cs	Tue Oct 13 19:33:13 2009 +0200
@@ -0,0 +1,41 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace FingersDance.Data
+{
+    [Serializable]
+    public class Project
+    {
+        private User _user = new User();
+        private Cutting _cutting = new Cutting();
+
+        #region Constructor
+        public Project(User u, Cutting c)
+        {
+            _user = u;
+            _cutting = c;
+        }
+
+        public Project()
+        {}
+
+        #endregion
+
+        #region Properties
+        public User User
+        {
+            get { return _user; }
+            set { _user = value; }
+        }
+        public Cutting Cutting
+        {
+            get { return _cutting; }
+            set { _cutting = value; }
+        }
+
+        #endregion
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/FingersDance.Data/Session.cs	Tue Oct 13 19:33:13 2009 +0200
@@ -0,0 +1,46 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace FingersDance.Data
+{
+    [Serializable]
+    public class Session
+    {
+        private String _videoname = "";
+        private String _videopath = "";
+        private Dictionary<String, Project> _projects = new Dictionary<String, Project>();
+
+        #region Constructor
+        public Session(String Videoname, String Videopath)
+        {
+            _videopath = Videopath;
+            _videoname = Videoname;
+        }
+        public Session()
+        {}
+
+        #endregion
+
+        #region Properties
+        public String VideoName
+        {
+            get { return _videoname; }
+            set { _videoname = value; }
+        }
+        public String Videopath
+        {
+            get { return _videopath; }
+            set { _videopath = value; }
+        }
+
+        public Dictionary<String, Project> Projects
+        {
+            get { return _projects; }
+            set { _projects = value; }
+        }
+
+        #endregion
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/FingersDance.Data/User.cs	Tue Oct 13 19:33:13 2009 +0200
@@ -0,0 +1,57 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace FingersDance.Data
+{
+    /// <summary>
+    /// Class data USER
+    /// Un user a une couleurs unique
+    /// </summary>
+    [Serializable]
+    public class User
+    {
+        private String _name="";
+        private String _email="";
+        private String _alias="";
+        private String _colorkey="";
+
+        #region Constructor
+        public User(String name, String email, String alias)
+        {
+            _name = name;
+            _email = email;
+            _alias = alias;
+        }
+
+        public User(String name, String email, String alias,String color)
+        {
+            _name = name;
+            _email = email;
+            _alias = alias;
+            _colorkey = color;
+        }
+        public User()
+        { }
+        #endregion
+
+        #region Properties
+        public String Name
+        {
+            get { return _name; }
+            set { _name = value; }
+        }
+        public String Email
+        {
+            get { return _email; }
+            set { _email = value; }
+        }
+        public String Alias
+        {
+            get { return _alias; }
+            set { _alias = value; }
+        }
+        #endregion
+    }
+}
--- a/src/FingersDance.Debug/FingersDance.Debug.csproj	Tue Oct 13 19:09:46 2009 +0200
+++ b/src/FingersDance.Debug/FingersDance.Debug.csproj	Tue Oct 13 19:33:13 2009 +0200
@@ -40,6 +40,23 @@
     <OutputPath>.\bin\Release\</OutputPath>
     <DefineConstants>TRACE</DefineConstants>
   </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\x86\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
+    <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+    <OutputPath>bin\x86\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <Optimize>true</Optimize>
+    <PlatformTarget>x86</PlatformTarget>
+    <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
+    <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
+  </PropertyGroup>
   <ItemGroup>
     <Reference Include="System" />
     <Reference Include="System.Core">
--- a/src/FingersDance.ViewModel/AnnotationViewModel.cs	Tue Oct 13 19:09:46 2009 +0200
+++ b/src/FingersDance.ViewModel/AnnotationViewModel.cs	Tue Oct 13 19:33:13 2009 +0200
@@ -13,10 +13,13 @@
         private float _dur;
         private String _gestureType;
 
-        public AnnotationViewModel(Annotation a) {
+        private float _marginLeft;
+
+        public AnnotationViewModel(Annotation a, float marginLeft) {
             this._tcBegin = a.TcBegin;
             this._dur = a.Dur;
             this._gestureType = a.GestureType;
+            this._marginLeft = marginLeft;
         }
 
         public float TcBegin
@@ -51,6 +54,17 @@
                 base.OnPropertyChanged("GestureType");
             }
         }
+        public float MarginLeft
+        {
+            get { return _marginLeft; }
+            set
+            {
+                if (value == _marginLeft || float.IsNaN(value))
+                    return;
+                _marginLeft = value;
+                base.OnPropertyChanged("MarginLeft");
+            }
+        }
 
     }
 }
--- a/src/FingersDance.ViewModel/CuttingViewModel.cs	Tue Oct 13 19:09:46 2009 +0200
+++ b/src/FingersDance.ViewModel/CuttingViewModel.cs	Tue Oct 13 19:33:13 2009 +0200
@@ -12,16 +12,20 @@
         private string _title;
         private List<AnnotationViewModel> _annotList = new List<AnnotationViewModel>();
 
-        public CuttingViewModel(Cutting c) {
+        public CuttingViewModel(Cutting c, float annotWidth) {
 
             this._title = c.Title;
             this._annotList = new List<AnnotationViewModel>();
+            int i = 0;
             foreach (Annotation annot in c.AnnotList)
-                this._annotList.Add(new AnnotationViewModel(annot));
+            {
+                this._annotList.Add(new AnnotationViewModel(annot, annot.TcBegin - (i * annotWidth)));
+                i++;
+            }
 
         }
 
-        public String Title
+        public String Title  
         {
             get { return _title; }
             set
@@ -41,5 +45,18 @@
                 base.OnPropertyChanged("AnnotList");
             }
         }
+
+        public void setListFromAnnotations(List<Annotation> annotList, float annotWidth)
+        {
+
+            this._annotList = new List<AnnotationViewModel>();
+            int i = 0;
+            foreach (Annotation annot in annotList)
+            {
+                this._annotList.Add(new AnnotationViewModel(annot, annot.TcBegin - (i * annotWidth)));
+                i++;
+            }
+
+        }
     }
 }
--- a/src/FingersDance.ViewModel/FingersDance.ViewModels.csproj	Tue Oct 13 19:09:46 2009 +0200
+++ b/src/FingersDance.ViewModel/FingersDance.ViewModels.csproj	Tue Oct 13 19:33:13 2009 +0200
@@ -3,7 +3,7 @@
   <PropertyGroup>
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
     <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ProductVersion>9.0.30729</ProductVersion>
+    <ProductVersion>9.0.21022</ProductVersion>
     <SchemaVersion>2.0</SchemaVersion>
     <ProjectGuid>{E81BB080-0598-43AC-90CE-54D6570C4E9E}</ProjectGuid>
     <OutputType>Library</OutputType>
@@ -32,6 +32,26 @@
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
   </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\x86\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
+    <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
+    <ErrorReport>prompt</ErrorReport>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+    <OutputPath>bin\x86\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <Optimize>true</Optimize>
+    <DebugType>pdbonly</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
+    <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
+    <ErrorReport>prompt</ErrorReport>
+  </PropertyGroup>
   <ItemGroup>
     <Reference Include="System" />
     <Reference Include="System.Core">
@@ -52,6 +72,8 @@
   <ItemGroup>
     <Compile Include="AnnotationViewModel.cs" />
     <Compile Include="CuttingViewModel.cs" />
+    <Compile Include="MainViewModel.cs" />
+    <Compile Include="ProjectViewModel.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
     <EmbeddedResource Include="Properties\Resources.resx">
       <Generator>ResXFileCodeGenerator</Generator>
@@ -72,6 +94,8 @@
       <DependentUpon>Settings.settings</DependentUpon>
       <DesignTimeSharedInput>True</DesignTimeSharedInput>
     </Compile>
+    <Compile Include="SessionViewModel.cs" />
+    <Compile Include="UserViewModel.cs" />
     <Compile Include="ViewModelBase.cs" />
   </ItemGroup>
   <ItemGroup>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/FingersDance.ViewModel/MainViewModel.cs	Tue Oct 13 19:33:13 2009 +0200
@@ -0,0 +1,63 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Collections.ObjectModel;
+
+using FingersDance.Data;
+
+namespace FingersDance.ViewModels
+{
+    public class MainViewModel
+    {
+        #region Attributes
+
+        public Dictionary<String, UserViewModel> Users = new Dictionary<string,UserViewModel>();
+        public SessionViewModel Session = new SessionViewModel();
+
+        #endregion
+        
+        #region Methods
+
+        public Project CreateProject(User u)
+        {
+            if (Users.ContainsKey(u.Email))
+            {
+                if (Session.Projects.ContainsKey(u.Email))
+                    return Session.Projects[u.Email];
+                else
+                {
+                    Project p = new Project(u, new Cutting());
+                    Session.Projects.Add(u.Email, p);
+                    return p;
+                }
+            }
+            else
+            {
+                AddUser(u);
+                Project p = new Project(u, new Cutting());
+                Session.Projects.Add(u.Email, p);
+                return p;
+            }
+        }
+
+        public void CreateSession(string name, string path)
+        {
+            Session = new SessionViewModel(new Session(name, path));
+        }
+
+        public void CloseSession()
+        {
+            Session = null;
+            Session = new SessionViewModel();
+        }
+
+        private void AddUser(User u)
+        {
+            UserViewModel uvm = new UserViewModel(u);
+            Users.Add(u.Email, uvm);
+        }
+
+        #endregion
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/FingersDance.ViewModel/ProjectViewModel.cs	Tue Oct 13 19:33:13 2009 +0200
@@ -0,0 +1,40 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using FingersDance.Data;
+
+namespace FingersDance.ViewModels
+{
+    public class ProjectViewModel : ViewModelBase
+    {
+        readonly Project project = new Project();
+
+        #region Constructor
+
+        public ProjectViewModel() { }
+
+        public ProjectViewModel(Project p)
+        {
+            project = p;
+        }
+
+        #endregion
+
+        #region Properties
+        
+        public User User
+        {
+            get { return project.User; }
+            set { project.User = value; }
+        }
+
+        public Cutting Cutting
+        {
+            get { return project.Cutting; }
+            set { project.Cutting = value; }
+        }
+
+        #endregion
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/FingersDance.ViewModel/SessionViewModel.cs	Tue Oct 13 19:33:13 2009 +0200
@@ -0,0 +1,46 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using FingersDance.Data;
+
+namespace FingersDance.ViewModels
+{
+    public class SessionViewModel
+    {
+        private Session session = new Session();
+
+        #region Constructor
+
+        public SessionViewModel() { }
+
+        public SessionViewModel(Session s)
+        {
+            session = s;
+        }
+
+        #endregion
+
+        #region Properties
+
+        public String VideoName
+        {
+            get { return session.VideoName; }
+            set { session.VideoName = value; }
+        }
+
+        public String VideoPath
+        {
+            get { return session.Videopath; }
+            set { session.Videopath = value; }
+        }
+
+        public Dictionary<String, Project> Projects
+        {
+            get { return session.Projects; }
+            set { session.Projects = value; }
+        }
+
+        #endregion
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/FingersDance.ViewModel/UserViewModel.cs	Tue Oct 13 19:33:13 2009 +0200
@@ -0,0 +1,41 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using FingersDance.Data;
+
+namespace FingersDance.ViewModels
+{
+    public class UserViewModel : ViewModelBase
+    {
+        readonly User user = new User();
+
+        #region Constructor
+
+        public UserViewModel(User u) {
+            user.Name = u.Name;
+            user.Email = u.Email;
+            user.Alias = u.Alias;
+            //Possibles Commands
+        }
+        #endregion
+
+        #region Properties
+        public String Name
+        {
+            get { return user.Name; }
+            set { user.Name = value; }
+        }
+        public String Email
+        {
+            get { return user.Email; }
+            set { user.Email = value; }
+        }
+        public String Alias
+        {
+            get { return user.Alias; }
+            set { user.Alias = value; }
+        }
+        #endregion
+    }
+}
--- a/src/FingersDance.Views/FingersDance.Views.csproj	Tue Oct 13 19:09:46 2009 +0200
+++ b/src/FingersDance.Views/FingersDance.Views.csproj	Tue Oct 13 19:33:13 2009 +0200
@@ -33,6 +33,26 @@
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
   </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+    <DebugSymbols>true</DebugSymbols>
+    <OutputPath>bin\x86\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DebugType>full</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
+    <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
+    <ErrorReport>prompt</ErrorReport>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+    <OutputPath>bin\x86\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <Optimize>true</Optimize>
+    <DebugType>pdbonly</DebugType>
+    <PlatformTarget>x86</PlatformTarget>
+    <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
+    <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
+    <ErrorReport>prompt</ErrorReport>
+  </PropertyGroup>
   <ItemGroup>
     <Reference Include="Microsoft.Surface, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
     <Reference Include="Microsoft.Surface.Presentation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
@@ -102,6 +122,16 @@
       <Generator>MSBuild:Compile</Generator>
     </Page>
   </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\FingersDance.Data\FingersDance.Data.csproj">
+      <Project>{EAF384DB-2AE4-4132-839D-60F9DAFDEAD8}</Project>
+      <Name>FingersDance.Data</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\FingersDance.ViewModel\FingersDance.ViewModels.csproj">
+      <Project>{E81BB080-0598-43AC-90CE-54D6570C4E9E}</Project>
+      <Name>FingersDance.ViewModels</Name>
+    </ProjectReference>
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
        Other similar extension points exist, see Microsoft.Common.targets.
--- a/src/FingersDance.Views/TimelineAnnotationView.xaml	Tue Oct 13 19:09:46 2009 +0200
+++ b/src/FingersDance.Views/TimelineAnnotationView.xaml	Tue Oct 13 19:33:13 2009 +0200
@@ -8,14 +8,20 @@
 	x:Class="FingersDance.Views.TimelineAnnotationView"
     xmlns:vw="clr-namespace:FingersDance.Views"
 	x:Name="UserControl"
-	d:DesignWidth="640" d:DesignHeight="480" Width="40">
+	d:DesignWidth="640" d:DesignHeight="480" Width="300" Height="40">
     <UserControl.Resources>
-        <vw:ThicknessSingleValueConverter x:Name="myThicknessSingleValueConverter" x:Key="myThicknessSingleValueConverter"></vw:ThicknessSingleValueConverter>
+        <vw:ThicknessSingleValueConverter x:Name="myThicknessSingleValueConverter" x:Key="myThicknessSingleValueConverter"/>
+        <vw:VisibilityConverter x:Name="myVisibilityConverter" x:Key="myVisibilityConverter"/>
     </UserControl.Resources>
-    <Grid x:Name="LayoutRoot" Margin="{Binding Path=TcBegin, Converter={StaticResource myThicknessSingleValueConverter}}">
-        <Ellipse Fill="Green" Margin="-2,-3,0,0" Height="6" VerticalAlignment="Top" HorizontalAlignment="Left" Width="6" />
-        <Rectangle Fill="Green" HorizontalAlignment="Left" VerticalAlignment="Top" Width="2" Height="20"/>
-        <Rectangle Fill="Green" HorizontalAlignment="Left" VerticalAlignment="Top" Width="{Binding Path=Dur}" Height="2" Margin="0,18,0,0"/>
-        <TextBox HorizontalAlignment="Left" Text="{Binding Path=GestureType}" Width="40" Margin="0,20,0,0"/>
-    </Grid>
+    <Custom:SurfaceUserControl x:Name="LayoutRoot" Margin="{Binding Path=MarginLeft, Converter={StaticResource myThicknessSingleValueConverter}}"
+                               >
+        <Grid>
+            <Rectangle Fill="Black" HorizontalAlignment="Left" VerticalAlignment="Top" Width="{Binding Path=Dur}" Height="40" Opacity="0.0"/>
+            <TextBox HorizontalAlignment="Left" Text="{Binding Path=GestureType}" Width="40" Margin="0,20,0,0" Visibility="{Binding Path=Dur, Converter={StaticResource myVisibilityConverter}}"/>
+            <Ellipse Stroke="Green" Fill="{x:Null}" Margin="-3,16,0,0" Height="8" VerticalAlignment="Top" HorizontalAlignment="Left" Width="8"/>
+            <Ellipse Fill="Green" Margin="-2,17,0,0" Height="6" VerticalAlignment="Top" HorizontalAlignment="Left" Width="6" Visibility="{Binding Path=Dur, Converter={StaticResource myVisibilityConverter}}" />
+            <Rectangle Fill="Green" HorizontalAlignment="Left" VerticalAlignment="Top" Width="2" Height="17"/>
+            <Rectangle Fill="Green" HorizontalAlignment="Left" VerticalAlignment="Top" Width="{Binding Path=Dur}" Height="2"/>
+        </Grid>
+    </Custom:SurfaceUserControl>
 </UserControl>
\ No newline at end of file
--- a/src/FingersDance.Views/TimelineAnnotationView.xaml.cs	Tue Oct 13 19:09:46 2009 +0200
+++ b/src/FingersDance.Views/TimelineAnnotationView.xaml.cs	Tue Oct 13 19:33:13 2009 +0200
@@ -11,6 +11,7 @@
 using System.Windows.Media.Imaging;
 using System.Windows.Navigation;
 using System.Windows.Shapes;
+using Microsoft.Surface.Presentation;
 
 namespace FingersDance.Views
 {
@@ -41,4 +42,17 @@
             return thickness.Left;
         }
     }
+
+    public class VisibilityConverter : IValueConverter
+    {
+        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
+        {
+            Visibility v = ((float)value>0) ? Visibility.Visible : Visibility.Hidden;
+            return v;
+        }
+        public object ConvertBack(object value, Type targetTypes, object parameter, System.Globalization.CultureInfo culture)
+        {
+            return 1.0;
+        }
+    }
 }
--- a/src/FingersDance.Views/TimelineView.xaml	Tue Oct 13 19:09:46 2009 +0200
+++ b/src/FingersDance.Views/TimelineView.xaml	Tue Oct 13 19:33:13 2009 +0200
@@ -2,9 +2,27 @@
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
     xmlns:vw="clr-namespace:FingersDance.Views"
-    >
+    xmlns:Custom="http://schemas.microsoft.com/surface/2008">
+    <UserControl.Resources>
+        <DataTemplate x:Key="slbDataTemplate">
+            <vw:TimelineAnnotationView/>
+        </DataTemplate>
+        <ItemsPanelTemplate x:Key="slbItemsPanelTemplate">
+            <!--
+            <Grid></Grid>
+            <Canvas></Canvas>
+            -->
+            <StackPanel Orientation="Horizontal"/>
+
+        </ItemsPanelTemplate>
+    </UserControl.Resources>
     <Grid>
-        <ListView DataContext="{Binding Path=AnnotList}"
+        <Custom:SurfaceListBox Background="{x:Null}" x:Name="listview" x:FieldModifier="public" ScrollViewer.HorizontalScrollBarVisibility="Hidden" BorderThickness="2"
+                               ItemsSource="{Binding Path=AnnotList}" ItemTemplate="{StaticResource slbDataTemplate}" ItemsPanel="{StaticResource slbItemsPanelTemplate}"
+                               >
+            
+        </Custom:SurfaceListBox>
+        <!--ListView DataContext="{Binding Path=AnnotList}"
                   ItemsSource="{Binding}" Background="{x:Null}" BorderThickness="0" x:Name="listview" ScrollViewer.HorizontalScrollBarVisibility="Hidden">
 
             <ListView.ItemTemplate>
@@ -18,21 +36,7 @@
                     <StackPanel Orientation="Horizontal"/>
                 </ItemsPanelTemplate>
             </ListView.ItemsPanel>
-            
-            <!--ListView.View>
-                <GridView>
-                    <GridViewColumn 
-                        Header="Gesture Type"
-                        DisplayMemberBinding="{Binding Path=GestureType}"/>
-                    <GridViewColumn 
-                        Header="Tc Begin"
-                        DisplayMemberBinding="{Binding Path=TcBegin}" />
-                    <GridViewColumn 
-                        Header="Dur"
-                        DisplayMemberBinding="{Binding Path=Dur}" />
-                </GridView>
-            </ListView.View-->
         </ListView>
-        <!--TextBlock Text="{Binding Path=Title}" Height="27" VerticalAlignment="Top" Margin="0,0,0,0" /-->
+        <TextBlock Text="{Binding Path=Title}" Height="27" VerticalAlignment="Top" Margin="0,0,0,0" /-->
     </Grid>
 </UserControl>
--- a/src/FingersDance.Views/TimelineView.xaml.cs	Tue Oct 13 19:09:46 2009 +0200
+++ b/src/FingersDance.Views/TimelineView.xaml.cs	Tue Oct 13 19:33:13 2009 +0200
@@ -6,12 +6,15 @@
 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.Navigation;
 using System.Windows.Shapes;
 
+using FingersDance.Data;
+using FingersDance.ViewModels;
+using FingersDance.Views;
+
 namespace FingersDance.Views
 {
     /// <summary>
@@ -19,9 +22,15 @@
     /// </summary>
     public partial class TimelineView : UserControl
     {
+
+        private Boolean hasDragCanceledHandler = false;
+
         public TimelineView()
         {
             InitializeComponent();
         }
+
+        
+
     }
 }
--- a/src/FingersDance/FingersDance.csproj	Tue Oct 13 19:09:46 2009 +0200
+++ b/src/FingersDance/FingersDance.csproj	Tue Oct 13 19:33:13 2009 +0200
@@ -134,8 +134,15 @@
     <Content Include="Resources\Lake.wmv">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </Content>
-    <Resource Include="Resources\oneflat.png" />
-    <Content Include="Resources\oneflat.wmv" />
+    <Content Include="Resources\oneflat.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Content>
+    <Content Include="Resources\oneflat.wmv">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Content>
+    <Content Include="Resources\videos.xml">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Content>
     <Resource Include="FingersDance.xml" />
   </ItemGroup>
   <ItemGroup>
@@ -152,6 +159,10 @@
       <Project>{C7B905EA-0678-4DA0-8EF8-7F9CBD22818E}</Project>
       <Name>FingersDance.ActionFactory</Name>
     </ProjectReference>
+    <ProjectReference Include="..\FingersDance.Control.Close\FingersDance.Control.Close.csproj">
+      <Project>{D579FDB5-D412-4797-A0FF-C5873AE08BB8}</Project>
+      <Name>FingersDance.Control.Close</Name>
+    </ProjectReference>
     <ProjectReference Include="..\FingersDance.Control.Menu\FingersDance.Control.Menu.csproj">
       <Project>{6960F7ED-3D82-4BCE-AB88-D31D6C72F2B6}</Project>
       <Name>FingersDance.Control.Menu</Name>
@@ -172,6 +183,14 @@
       <Project>{E6A3A067-1CB4-43D2-BB9C-DC72361F7E22}</Project>
       <Name>FingersDance.Control.UserPanel</Name>
     </ProjectReference>
+    <ProjectReference Include="..\FingersDance.Data\FingersDance.Data.csproj">
+      <Project>{EAF384DB-2AE4-4132-839D-60F9DAFDEAD8}</Project>
+      <Name>FingersDance.Data</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\FingersDance.ViewModel\FingersDance.ViewModels.csproj">
+      <Project>{E81BB080-0598-43AC-90CE-54D6570C4E9E}</Project>
+      <Name>FingersDance.ViewModels</Name>
+    </ProjectReference>
   </ItemGroup>
   <ItemGroup>
     <BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
--- a/src/FingersDance/MainSurfaceWindow.xaml	Tue Oct 13 19:09:46 2009 +0200
+++ b/src/FingersDance/MainSurfaceWindow.xaml	Tue Oct 13 19:33:13 2009 +0200
@@ -16,7 +16,7 @@
     x:Class="FingersDance.SurfaceWindow1"
     Title="FingersDance"
     Width="1024" Height="768" x:Name="mainSurfaceWindow" 
-    Background="{x:Null}"
+    Background="{x:Null}" Loaded="mainSurfaceWindow_Loaded"
     
     
     >
@@ -125,6 +125,9 @@
   		</Setter>
   	</Style>
   </s:SurfaceWindow.Resources>
+	<s:SurfaceWindow.Triggers>
+		<EventTrigger RoutedEvent="FrameworkElement.Loaded"/>
+	</s:SurfaceWindow.Triggers>
 
   <Grid x:Name="MainGrid" Width="1024" Height="768" >
   	<Grid.Background>
@@ -145,7 +148,7 @@
   			</TransformGroup>
   		</Grid.RenderTransform>
   		
-  		<Rectangle Fill="{x:Null}" Stroke="#FFFFFFFF" x:Name="rect1"/>
+  		<Rectangle Fill="{x:Null}" Stroke="#FFFFFFFF" x:Name="rect1" StrokeThickness="0.1"/>
   	</Grid>
   	<Grid HorizontalAlignment="Right" Margin="0,0,0,0" x:Name="Grid2" VerticalAlignment="Top" Width="100" Height="100" Background="{x:Null}" RenderTransformOrigin="0.5,0.5">
   		<Grid.RenderTransform>
@@ -157,7 +160,7 @@
   			</TransformGroup>
   		</Grid.RenderTransform>
   		
-  		<Rectangle Fill="{x:Null}" Stroke="#FFFFFFFF" x:Name="rect2"/>
+  		<Rectangle Fill="{x:Null}" Stroke="#FFFFFFFF" x:Name="rect2" StrokeThickness="0.1"/>
   	</Grid>
   	<Grid RenderTransformOrigin="0.5,0.5" HorizontalAlignment="Left" Margin="0,0,0,0" x:Name="Grid3" VerticalAlignment="Bottom" Width="100" Height="100" Background="{x:Null}">
   		<Grid.RenderTransform>
@@ -168,12 +171,12 @@
   				<TranslateTransform X="0" Y="0"/>
   			</TransformGroup>
   		</Grid.RenderTransform>
-  		<Rectangle Fill="{x:Null}" Stroke="#FFFFFFFF" x:Name="rect3"/>
+  		<Rectangle Fill="{x:Null}" Stroke="#FFFFFFFF" x:Name="rect3" StrokeThickness="0.1"/>
   		
   	</Grid>
   	<Grid HorizontalAlignment="Right" Margin="0,0,0,0" x:Name="Grid4" VerticalAlignment="Bottom" Width="100" Height="100" Background="{x:Null}">
   		
-  		<Rectangle Fill="{x:Null}" Stroke="#FFFFFFFF" x:Name="rect4"/>
+  		<Rectangle Fill="{x:Null}" Stroke="#FFFFFFFF" x:Name="rect4" StrokeThickness="0.1"/>
   	</Grid>
   	<s:ScatterView x:Name="scaterview"  ContactChanged="scaterview_ContactChanged">
   		<s:ScatterViewItem   Center="512,384" CanMove="True" CanRotate="False" CanScale="False" Background="{x:Null}" x:Name="ScatterViewItemPivot" ContactChanged="ScatterViewItemPivot_ContactChanged" Style="{DynamicResource FingersDance.Control.ScatterView}" BorderBrush="{x:Null}" Foreground="{x:Null}" >
--- a/src/FingersDance/MainSurfaceWindow.xaml.cs	Tue Oct 13 19:09:46 2009 +0200
+++ b/src/FingersDance/MainSurfaceWindow.xaml.cs	Tue Oct 13 19:33:13 2009 +0200
@@ -17,6 +17,9 @@
 
 using FingersDance.Control.UserPanel;
 using FingersDance.Control.Screen;
+using FingersDance.Control.Close;
+using FingersDance.ViewModels;
+using FingersDance.Data;
 
 
 namespace FingersDance
@@ -31,14 +34,18 @@
         /// </summary>
         /// 
         #region Variables
+
         private UserControlUserPanel Panel1 = null;
         private UserControlUserPanel Panel2 = null;
         private UserControlUserPanel Panel3 = null;
         private UserControlUserPanel Panel4 = null;
+        ActionFactory.ActionGenerator _Factory = new FingersDance.ActionFactory.ActionFactory().GetGenerator();
+        private MainViewModel _mainviewmodel = new MainViewModel();      
+
         #endregion
 
-        ActionFactory.ActionGenerator _Factory = new FingersDance.ActionFactory.ActionFactory().GetGenerator();
 
+        #region Constructor
         public SurfaceWindow1()
         {
             InitializeComponent();
@@ -50,6 +57,9 @@
             // Add handlers for Application activation events
             AddActivationHandlers();
         }
+        #endregion
+
+        #region Initialization
 
         private void InitPivotInertia()
         {
@@ -82,6 +92,7 @@
             catch (Exception ex) { }
         }
 
+        #endregion
 
         /// <summary>
         /// Occurs when the window is about to close. 
@@ -125,6 +136,7 @@
         private void OnApplicationActivated(object sender, EventArgs e)
         {
             //TODO: enable audio, animations here
+
         }
 
         /// <summary>
@@ -149,6 +161,29 @@
             //TODO: disable audio, animations here
         }
 
+        /// <summary>
+        ///  This is called when application has been loaded, we change the orientation
+        ///  of the application
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void mainSurfaceWindow_Loaded(object sender, RoutedEventArgs e)
+        {
+
+            if (ApplicationLauncher.InitialOrientation == UserOrientation.Top)
+            {
+                // Rotate the main canvas by 180 degrees.
+                this.MainGrid.LayoutTransform = new RotateTransform(180.0);
+            }
+            else
+            {
+                // Remove the rotate transform on the main canvas.
+                this.MainGrid.LayoutTransform = null;
+            }
+            // Dismiss the loading screen.
+            ApplicationLauncher.SignalApplicationLoadComplete();
+        }
+
         private void scaterview_ContactChanged(object sender, ContactEventArgs e)
         {  }
 
@@ -228,13 +263,18 @@
 
         private void UserControlPivot_EH_SurfaceButtonPlayer_ContactDown(object sender, EventArgs e)
         {
+            //  Si aucune video n'a été sélectionnée et qu'une grid contient un élément (listvideo), on ne fait rien
+            if (_mainviewmodel.Session.VideoPath.Equals("") && (Grid1.Children.Count == 2 || Grid2.Children.Count == 2 || Grid3.Children.Count == 2 || Grid4.Children.Count == 2))
+                return;
+
+            //  Traitement du contact down sur le pivot (Création d'un screen ou suppression d'un panel
             switch ((int)sender)
             {
                 case 1:
-                    if (Panel1 == null)
+                    if (Panel1 == null && Grid1.Children.Count == 1)
                     {
                         //1-Creation du control Screen
-                        UserControlScreen Screen = new UserControlScreen(1);
+                        UserControlScreen Screen = new UserControlScreen(1, _mainviewmodel);
                         Screen.Name = "Screen1";
                         Screen.contexteGrid = Grid1.Name.ToString();
                         //2-Rajout du screen dans la grid correspondante
@@ -242,12 +282,22 @@
 
                         Screen.UC_Screen_NewSession += new System.EventHandler(this.SessionInput_EH_SurfaceButtonSubmit_ContactDown);
                     }
+                    else //Affichage du message de confirmation
+                    {
+                        if (Panel1 != null && Grid1.Children.Count == 2)
+                        {
+                            UserControlClose UCclose = new UserControlClose(1);
+                            UCclose.Name = "CloseAlert1";
+                            Grid1.Children.Add(UCclose);
+                            UCclose.EH_SurfaceButtonClose_ContactDown += new EventHandler(CloseAlert_EH_SurfaceButton_ContactDown);
+                        }
+                    }
                     break;
                 case 2:
-                    if (Panel2 == null)
+                    if (Panel2 == null && Grid2.Children.Count == 1)
                     {
                         //1-Creation du control Screen
-                        UserControlScreen Screen = new UserControlScreen(2);
+                        UserControlScreen Screen = new UserControlScreen(2, _mainviewmodel);
                         Screen.Name = "Screen2";
                         Screen.contexteGrid = Grid2.Name.ToString();
                         //2-Rajout du screen dans la grid correspondante
@@ -255,12 +305,22 @@
 
                         Screen.UC_Screen_NewSession += new System.EventHandler(this.SessionInput_EH_SurfaceButtonSubmit_ContactDown);
                     }
+                    else //Affichage du message de confirmation
+                    {
+                        if (Panel2 != null && Grid2.Children.Count == 2)
+                        {
+                            UserControlClose UCclose = new UserControlClose(2);
+                            UCclose.Name = "CloseAlert2";
+                            Grid2.Children.Add(UCclose);
+                            UCclose.EH_SurfaceButtonClose_ContactDown += new EventHandler(CloseAlert_EH_SurfaceButton_ContactDown);
+                        }
+                    }
                     break;
                 case 3:
-                    if (Panel3 == null)
+                    if (Panel3 == null && Grid3.Children.Count == 1)
                     {
                         //1-Creation du control Screen
-                        UserControlScreen Screen = new UserControlScreen(3);
+                        UserControlScreen Screen = new UserControlScreen(3, _mainviewmodel);
                         Screen.Name = "Screen3";
                         Screen.contexteGrid = Grid3.Name.ToString();
                         //2-Rajout du screen dans la grid correspondante
@@ -268,12 +328,22 @@
 
                         Screen.UC_Screen_NewSession += new System.EventHandler(this.SessionInput_EH_SurfaceButtonSubmit_ContactDown);
                     }
+                    else //Affichage du message de confirmation
+                    {
+                        if (Panel3 != null && Grid3.Children.Count == 2)
+                        {
+                            UserControlClose UCclose = new UserControlClose(3);
+                            UCclose.Name = "CloseAlert3";
+                            Grid3.Children.Add(UCclose);
+                            UCclose.EH_SurfaceButtonClose_ContactDown += new EventHandler(CloseAlert_EH_SurfaceButton_ContactDown);
+                        }
+                    }
                     break;
                 case 4:
-                    if (Panel4 == null)
+                    if (Panel4 == null && Grid4.Children.Count == 1)
                     {
                         //1-Creation du control Screen
-                        UserControlScreen Screen = new UserControlScreen(4);
+                        UserControlScreen Screen = new UserControlScreen(4, _mainviewmodel);
                         Screen.Name = "Screen4";
                         Screen.contexteGrid = Grid4.Name.ToString();
                         //2-Rajout du screen dans la grid correspondante
@@ -281,6 +351,16 @@
 
                         Screen.UC_Screen_NewSession += new System.EventHandler(this.SessionInput_EH_SurfaceButtonSubmit_ContactDown);
                     }
+                    else //Affichage du message de confirmation
+                    {
+                        if (Panel4 != null && Grid4.Children.Count == 2)
+                        {
+                            UserControlClose UCclose = new UserControlClose(4);
+                            UCclose.Name = "CloseAlert4";
+                            Grid4.Children.Add(UCclose);
+                            UCclose.EH_SurfaceButtonClose_ContactDown += new EventHandler(CloseAlert_EH_SurfaceButton_ContactDown);
+                        }
+                    }
                     break;
             }
                         
@@ -295,28 +375,33 @@
                 Grid root = (Grid)(((UserControlScreen)sender).Parent);
                 root.Children.Remove(((UserControlScreen)sender));
                 //2-Creation du User Panel
+                Project newProject = _mainviewmodel.CreateProject(((UserControlScreen)sender).User);
+
+                if ((Panel1 != null && Panel1.Project.Equals(newProject)) || (Panel2 != null && Panel2.Project.Equals(newProject)) || (Panel3 != null && Panel3.Project.Equals(newProject)) || (Panel4 != null && Panel4.Project.Equals(newProject)))
+                    return;
+
                 switch (((UserControlScreen)sender).id)
                 {
                     case 1:
-                        Panel1 = new UserControlUserPanel(((UserControlScreen)sender).Path);
+                        Panel1 = new UserControlUserPanel(newProject, _mainviewmodel.Session.VideoPath);
                         Panel1.Name = "UserPanel1";
                         //3-Rajout sur la Grid Root
                         root.Children.Add(Panel1);
                         break;
                     case 2:
-                        Panel2 = new UserControlUserPanel(((UserControlScreen)sender).Path);
+                        Panel2 = new UserControlUserPanel(newProject, _mainviewmodel.Session.VideoPath);
                         Panel2.Name = "UserPanel2";
                         //3-Rajout sur la Grid Root
                         root.Children.Add(Panel2);
                         break;
                     case 3:
-                        Panel3 = new UserControlUserPanel(((UserControlScreen)sender).Path);
+                        Panel3 = new UserControlUserPanel(newProject, _mainviewmodel.Session.VideoPath);
                         Panel3.Name = "UserPanel3";
                         //3-Rajout sur la Grid Root
                         root.Children.Add(Panel3);
                         break;
                     case 4:
-                        Panel4 = new UserControlUserPanel(((UserControlScreen)sender).Path);
+                        Panel4 = new UserControlUserPanel(newProject, _mainviewmodel.Session.VideoPath);
                         Panel4.Name = "UserPanel4";
                         //3-Rajout sur la Grid Root
                         root.Children.Add(Panel4);
@@ -326,7 +411,38 @@
             catch (Exception ex) { }
         }
 
+        //Actions du boutton Alert selon l'action close OK ou NON
+        private void CloseAlert_EH_SurfaceButton_ContactDown(object sender, EventArgs e)
+        {
+            Grid root = (Grid)(((UserControlClose)sender).Parent);
+            if(((UserControlClose) sender).close)
+            {
+                switch(((UserControlClose)sender).Id)
+                {
+                    case 1:
+                        root.Children.Remove(Panel1);
+                        Panel1 = null;
+                        break;
+                    case 2:
+                        root.Children.Remove(Panel2);
+                        Panel2 = null;
+                        break;
+                    case 3:
+                        root.Children.Remove(Panel3);
+                        Panel3 = null;
+                        break;
+                    case 4:
+                        root.Children.Remove(Panel4);
+                        Panel4 = null;
+                        break;
+                }
+            }
+            root.Children.Remove(((UserControlClose)sender));
 
+            //  S'il ne reste aucun panel d'ouvert, on ferme la session
+            if (Panel1 == null && Panel2 == null && Panel3 == null && Panel4 == null)
+                _mainviewmodel.CloseSession();
+        }
 
     }
 }
\ No newline at end of file
--- a/src/FingersDance/Resources/videos.xml	Tue Oct 13 19:09:46 2009 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<ArrayOfListVideoItem xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
-  <ListVideoItem>
-    <Name>Butterfly</Name>
-    <Path>C:\Users\Public\Public Dev\fingersdance\src\FingersDance\Resources\Butterfly.wmv</Path>
-    <Preview>C:\Users\Public\Public Dev\fingersdance\src\FingersDance\Resources\Butterfly.jpg</Preview>
-  </ListVideoItem>
-  <ListVideoItem>
-    <Name>Lake</Name>
-    <Path>C:\Users\Public\Public Dev\fingersdance\src\FingersDance\Resources\Lake.wmv</Path>
-    <Preview>C:\Users\Public\Public Dev\fingersdance\src\FingersDance\Resources\Lake.jpg</Preview>
-  </ListVideoItem>
-  <ListVideoItem>
-    <Name>One Flat Thing</Name>
-    <Path>C:\Users\Public\Public Dev\fingersdance\src\FingersDance\Resources\oneflat.wmv</Path>
-    <Preview>C:\Users\Public\Public Dev\fingersdance\src\FingersDance\Resources\oneflat.png</Preview>
-  </ListVideoItem>
-</ArrayOfListVideoItem>
\ No newline at end of file