drag and drop places the video at the good timecode.
--- a/src/FingersDance.Control.Player/FingersDance.Control.Player.csproj Mon Oct 05 19:27:24 2009 +0200
+++ b/src/FingersDance.Control.Player/FingersDance.Control.Player.csproj Tue Oct 06 14:02:09 2009 +0200
@@ -146,6 +146,14 @@
<Project>{1E80D5A1-C45C-443B-8992-4A4D78D280FC}</Project>
<Name>FingersDance.Actions</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 Mon Oct 05 19:27:24 2009 +0200
+++ b/src/FingersDance.Control.Player/UserControlPlayer.xaml Tue Oct 06 14:02:09 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,27 @@
</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}"
+ AllowDrop="True">
+ <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" AllowDrop="True">
+ <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"
+ AllowDrop="True" />
+ <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 Mon Oct 05 19:27:24 2009 +0200
+++ b/src/FingersDance.Control.Player/UserControlPlayer.xaml.cs Tue Oct 06 14:02:09 2009 +0200
@@ -11,6 +11,10 @@
using System.ComponentModel;
using System.Reflection;
+using Microsoft.Surface.Presentation;
+using FingersDance.Views;
+using FingersDance.ViewModels;
+
namespace FingersDance.Control.Player
{
public partial class UserControlPlayer
@@ -171,5 +175,32 @@
if(PlayerOpened!=null)
PlayerOpened(this, new EventArgs());
}
+
+ private void Play_Pause_area_DragEnter(object sender, SurfaceDragDropEventArgs e)
+ {
+ //Console.WriteLine("Enter");
+ //Play_Pause_area.Opacity = 0.5;
+ }
+
+ 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");
+ // 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);
+ }
}
}
\ No newline at end of file