--- a/src/FingersDance.Control.Player/UserControlPlayer.xaml.cs Wed Oct 07 17:16:46 2009 +0200
+++ b/src/FingersDance.Control.Player/UserControlPlayer.xaml.cs Fri Oct 09 11:33:35 2009 +0200
@@ -16,6 +16,7 @@
using Microsoft.Surface.Presentation.Controls;
using FingersDance.ActionFactory;
using FingersDance.Actions;
+using FingersDance.Control.TimeLine;
using FingersDance.Views;
using FingersDance.ViewModels;
@@ -183,7 +184,28 @@
private void Play_Pause_area_DragEnter(object sender, SurfaceDragDropEventArgs e)
{
//Console.WriteLine("Enter");
- Play_Pause_area.Opacity = 0.5;
+
+ // 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)