--- a/src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml.cs Fri Nov 13 11:58:42 2009 +0100
+++ b/src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml.cs Fri Nov 13 20:10:00 2009 +0100
@@ -33,6 +33,8 @@
public event EventHandler DragStarted;
public event EventHandler DragCompleted;
public event EventHandler TimerTick;
+ public event EventHandler AnnotationAdded;
+ public event EventHandler AnnotationRemoved;
//SAR
public event EventHandler OnSuccessAnnotation;
//ENDSAR
@@ -281,8 +283,11 @@
// If everything's fine, we create the new one
if (annotOk == true)
{
- cut.AnnotList.Add(new Annotation("s_" + System.Guid.NewGuid(), avm.TcBegin, avm.Dur, avm.GestureType, avm.Color));
+ Annotation annotation = new Annotation("s_" + System.Guid.NewGuid(), avm.TcBegin, avm.Dur, avm.GestureType, avm.Color);
+ cut.AnnotList.Add(annotation);
tv.DataContext = new CuttingViewModel(cut, AnnotWidth, tv.ScaleX);
+ if (AnnotationAdded != null)
+ AnnotationAdded(annotation, null);
AnnotWaiting = false;
}
@@ -313,7 +318,8 @@
// if not, we mark the beginning
if (annotOk == true)
{
- cut.AnnotList.Add(new Annotation("s_" + System.Guid.NewGuid(), AnnotTcBegin, 0, gestureType, CurrentColor));
+ cut.AnnotList.Add(new Annotation("s_" + System.Guid.NewGuid(), AnnotTcBegin, 0, cut.AnnotList.Count.ToString(), CurrentColor));
+ cut.AnnotList.Add(annotation);
tv.DataContext = new CuttingViewModel(cut, AnnotWidth, tv.ScaleX);
AnnotWaiting = true;
}
@@ -338,10 +344,13 @@
if (annotOk == true)
{
cut.AnnotList.RemoveAt(cut.AnnotList.Count - 1);
- cut.AnnotList.Add(new Annotation("s_" + System.Guid.NewGuid(), AnnotTcBegin, currentDuration, gestureType, CurrentColor));
+ Annotation annotation = new Annotation("s_" + System.Guid.NewGuid(), AnnotTcBegin, currentDuration, gestureType, CurrentColor);
+ cut.AnnotList.Add(annotation);
//Console.WriteLine("currentTimecode = " + AnnotTcBegin + ", curDur = " + currentDuration + ", nb = " + cut.AnnotList.Count + ", res = " + (AnnotTcBegin - (cut.AnnotList.Count * AnnotWidth)));
tv.DataContext = new CuttingViewModel(cut, AnnotWidth, tv.ScaleX);
AnnotWaiting = false;
+ if (AnnotationAdded != null)
+ AnnotationAdded(annotation, null);
}
//Raise Event to display Annotation in all Openned UserPanels
if (annotOk)
@@ -447,6 +456,8 @@
// We close the popup and return as soon as we removed the annotation to avoid an error on cut.AnnotList, which is just modified
confirmCancelPopup.Visibility = Visibility.Hidden;
canceledAnnotationVM = null;
+ if (AnnotationRemoved != null)
+ AnnotationRemoved(a, null);
return;
}
}