# HG changeset patch # User cavaliet # Date 1253108168 -7200 # Node ID a4c44555f205a0cf29cc517ab969dcaff02dc3d6 # Parent 5f547156bda62dd50d198d6d36f9bf15de6c02ab First Data binding for annotations and timeline diff -r 5f547156bda6 -r a4c44555f205 src/FingersDance.Control.SyncSource/UserControlSyncSource.xaml --- a/src/FingersDance.Control.SyncSource/UserControlSyncSource.xaml Wed Sep 16 09:07:27 2009 +0200 +++ b/src/FingersDance.Control.SyncSource/UserControlSyncSource.xaml Wed Sep 16 15:36:08 2009 +0200 @@ -10,8 +10,8 @@ x:Name="UserControl" Height="384" Width="512"> - - + + diff -r 5f547156bda6 -r a4c44555f205 src/FingersDance.Control.TimeLine/FingersDance.Control.TimeLine.csproj --- a/src/FingersDance.Control.TimeLine/FingersDance.Control.TimeLine.csproj Wed Sep 16 09:07:27 2009 +0200 +++ b/src/FingersDance.Control.TimeLine/FingersDance.Control.TimeLine.csproj Wed Sep 16 15:36:08 2009 +0200 @@ -118,5 +118,19 @@ + + + {EAF384DB-2AE4-4132-839D-60F9DAFDEAD8} + FingersDance.Data + + + {E81BB080-0598-43AC-90CE-54D6570C4E9E} + FingersDance.ViewModels + + + {0B308B6E-7B1E-46C0-ACC7-0B7EFC4D0B2C} + FingersDance.Views + + \ No newline at end of file diff -r 5f547156bda6 -r a4c44555f205 src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml --- a/src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml Wed Sep 16 09:07:27 2009 +0200 +++ b/src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml Wed Sep 16 15:36:08 2009 +0200 @@ -5,10 +5,12 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" x:Class="FingersDance.Control.TimeLine.UserControlTimeLine" + xmlns:vw="clr-namespace:FingersDance.Views;assembly=FingersDance.Views" x:Name="UserControl" d:DesignWidth="383" xmlns:Custom="http://schemas.microsoft.com/surface/2008" Height="Auto" Background="{x:Null}" d:DesignHeight="33"> - + + \ No newline at end of file diff -r 5f547156bda6 -r a4c44555f205 src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml.cs --- a/src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml.cs Wed Sep 16 09:07:27 2009 +0200 +++ b/src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml.cs Wed Sep 16 15:36:08 2009 +0200 @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.IO; using System.Net; using System.Windows; @@ -11,6 +12,9 @@ using Microsoft.Surface.Presentation.Controls; using System.Windows.Threading; +using FingersDance.Data; +using FingersDance.ViewModels; + namespace FingersDance.Control.TimeLine { public partial class UserControlTimeLine @@ -85,11 +89,24 @@ this.InitializeComponent(); // Insert code required on object creation below this point. + } public void initslider(double totalmilliseconds) { slider.Maximum = totalmilliseconds; + + + // TEMP FOR DATA BINDING + 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")); + Cutting cut = new Cutting("titre de cutting", annotList); + CuttingViewModel cutvm = new CuttingViewModel(cut); + tv.DataContext = cut; + + } #region Timer diff -r 5f547156bda6 -r a4c44555f205 src/FingersDance.Data/Annotation.cs --- a/src/FingersDance.Data/Annotation.cs Wed Sep 16 09:07:27 2009 +0200 +++ b/src/FingersDance.Data/Annotation.cs Wed Sep 16 15:36:08 2009 +0200 @@ -5,21 +5,21 @@ namespace FingersDance.Data { - class AnnotationAddedEventArg : EventArgs + public class AnnotationAddedEventArg : EventArgs { private float _tcBegin; private float _dur; private String _gestureType; - public float tcBegin + public float TcBegin { get { return this._tcBegin; } } - public float dur + public float Dur { get { return this._dur; } } - public String gestureType + public String GestureType { get { return this._gestureType; } } @@ -34,22 +34,53 @@ } - class Annotation + public class Annotation { - private float tcBegin; - private float dur; - private string gestureType; + private float _tcBegin; + private float _dur; + private string _gestureType; - public event EventHandler AnnotationAdded; + //public event EventHandler AnnotationAdded; public Annotation(float tcBeginPar, float durPar, string gesturePar) { - this.tcBegin = tcBeginPar; - this.dur = durPar; - this.gestureType = gesturePar; + this._tcBegin = tcBeginPar; + this._dur = durPar; + this._gestureType = gesturePar; + + //AnnotationAdded(this, new AnnotationAddedEventArg(_tcBegin, _dur, _gestureType)); + + } - AnnotationAdded(this, new AnnotationAddedEventArg(tcBegin, dur, gestureType)); - + public float TcBegin + { + get { return _tcBegin; } + set + { + if (value == _tcBegin || float.IsNaN(value)) + return; + _tcBegin = value; + } + } + public float Dur + { + get { return _dur; } + set + { + if (value == _dur || float.IsNaN(value)) + return; + _dur = value; + } + } + public String GestureType + { + get { return _gestureType; } + set + { + if (value == _gestureType || String.IsNullOrEmpty(value)) + return; + _gestureType = value; + } } } diff -r 5f547156bda6 -r a4c44555f205 src/FingersDance.Data/Cutting.cs --- a/src/FingersDance.Data/Cutting.cs Wed Sep 16 09:07:27 2009 +0200 +++ b/src/FingersDance.Data/Cutting.cs Wed Sep 16 15:36:08 2009 +0200 @@ -5,16 +5,36 @@ namespace FingersDance.Data { - class Cutting + public class Cutting { - private List annotList; - private string title; + private List _annotList; + private string _title; public Cutting(string titlePar, List annotListPar) { - this.title = titlePar; - this.annotList = annotListPar; + this._title = titlePar; + this._annotList = annotListPar; } + + public String Title + { + get { return _title; } + set + { + if (value == _title || String.IsNullOrEmpty(value)) + return; + _title = value; + } + } + public List AnnotList + { + get { return _annotList; } + set + { + _annotList = value; + } + } + } } diff -r 5f547156bda6 -r a4c44555f205 src/FingersDance.ViewModel/AnnotationViewModel.cs --- a/src/FingersDance.ViewModel/AnnotationViewModel.cs Wed Sep 16 09:07:27 2009 +0200 +++ b/src/FingersDance.ViewModel/AnnotationViewModel.cs Wed Sep 16 15:36:08 2009 +0200 @@ -3,15 +3,23 @@ using System.Linq; using System.Text; -namespace FingersDance.ViewModel +using FingersDance.Data; + +namespace FingersDance.ViewModels { - class AnnotationViewModel : ViewModelBase + public class AnnotationViewModel : ViewModelBase { private float _tcBegin; private float _dur; private String _gestureType; - public float tcBegin + public AnnotationViewModel(Annotation a) { + this._tcBegin = a.TcBegin; + this._dur = a.Dur; + this._gestureType = a.GestureType; + } + + public float TcBegin { get { return _tcBegin; } set { @@ -21,7 +29,7 @@ base.OnPropertyChanged("TcBegin"); } } - public float dur + public float Dur { get { return _dur; } set @@ -32,7 +40,7 @@ base.OnPropertyChanged("Dur"); } } - public String gestureType + public String GestureType { get { return _gestureType; } set diff -r 5f547156bda6 -r a4c44555f205 src/FingersDance.ViewModel/CuttingViewModel.cs --- a/src/FingersDance.ViewModel/CuttingViewModel.cs Wed Sep 16 09:07:27 2009 +0200 +++ b/src/FingersDance.ViewModel/CuttingViewModel.cs Wed Sep 16 15:36:08 2009 +0200 @@ -3,13 +3,24 @@ using System.Linq; using System.Text; -namespace FingersDance.ViewModel +using FingersDance.Data; + +namespace FingersDance.ViewModels { - class CuttingViewModel : ViewModelBase + public class CuttingViewModel : ViewModelBase { private string _title; private List _annotList = new List(); - + + public CuttingViewModel(Cutting c) { + + this._title = c.Title; + this._annotList = new List(); + foreach (Annotation annot in c.AnnotList) + this._annotList.Add(new AnnotationViewModel(annot)); + + } + public String Title { get { return _title; } diff -r 5f547156bda6 -r a4c44555f205 src/FingersDance.ViewModel/FingersDance.ViewModels.csproj --- a/src/FingersDance.ViewModel/FingersDance.ViewModels.csproj Wed Sep 16 09:07:27 2009 +0200 +++ b/src/FingersDance.ViewModel/FingersDance.ViewModels.csproj Wed Sep 16 15:36:08 2009 +0200 @@ -8,8 +8,8 @@ {E81BB080-0598-43AC-90CE-54D6570C4E9E} Library Properties - FingersDance.ViewModel - FingersDance.ViewModel + FingersDance.ViewModels + FingersDance.ViewModels v3.5 512 @@ -61,6 +61,7 @@ True Resources.resx + True SettingsSingleFileGenerator @@ -73,6 +74,12 @@ + + + {EAF384DB-2AE4-4132-839D-60F9DAFDEAD8} + FingersDance.Data + +