diff -r bda95242e600 -r 5af0f0a8706d src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml.cs --- a/src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml.cs Thu Sep 17 12:53:22 2009 +0200 +++ b/src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml.cs Thu Sep 17 18:44:33 2009 +0200 @@ -30,6 +30,11 @@ public event EventHandler DragCompleted; public event EventHandler TimerTick; + private List annotList = new List(); + private float annotWidth = 40; + private CuttingViewModel cutvm; + private int numAnnot = 1; + #region Properties public SurfaceSlider Slider @@ -85,7 +90,7 @@ public UserControlTimeLine() - { + { this.InitializeComponent(); // Insert code required on object creation below this point. @@ -98,15 +103,24 @@ // TEMP FOR DATA BINDING - List annotList = new List(); + annotList = new List(); annotList.Add(new Annotation(0, 10, "Axe Cam 1")); - annotList.Add(new Annotation(10, 20, "Mvt Cam 2")); - annotList.Add(new Annotation(30, 40, "Saut 3")); + 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); - CuttingViewModel cutvm = new CuttingViewModel(cut); - tv.DataContext = cut; + cutvm = new CuttingViewModel(cut); + tv.DataContext = cutvm; - + numAnnot = 6; + slider_ContactTapGesture(this,null); + /* + cutvm.AnnotList.Add(new AnnotationViewModel(new Annotation(180 - (5 * annotWidth), 10, "6"))); + tv.DataContext = null; + tv.DataContext = cutvm; + numAnnot = 7; + */ } #region Timer @@ -172,5 +186,18 @@ DragCompleted(this, new EventArgs()); } + private void slider_ContactTapGesture(object sender, Microsoft.Surface.Presentation.ContactEventArgs e) + { + addAnnotation(); + } + + public void addAnnotation() + { + cutvm.AnnotList.Add(new AnnotationViewModel(new Annotation(180 + (numAnnot - 6) * 20 - ((numAnnot - 1) * annotWidth), 10, numAnnot.ToString()))); + tv.DataContext = null; + tv.DataContext = cutvm; + numAnnot++; + } + } } \ No newline at end of file