diff -r d96cd2bce653 -r 48b3139bb182 src/FingersDance.Control.SyncSource/UserControlSyncSource.xaml.cs --- a/src/FingersDance.Control.SyncSource/UserControlSyncSource.xaml.cs Fri Nov 13 11:58:42 2009 +0100 +++ b/src/FingersDance.Control.SyncSource/UserControlSyncSource.xaml.cs Fri Nov 13 20:10:00 2009 +0100 @@ -9,6 +9,7 @@ using System.Windows.Navigation; using FingersDance.Control.TimeLine; using FingersDance.Data; +using FingersDance.Factory; namespace FingersDance.Control.SyncSource { @@ -31,10 +32,33 @@ //Initialisation du Timer UCTimeLine.initTimer(col, cut); this.UserControlPlayer.playerPlay(); - this.userControlTimeLine.OnSuccessAnnotation+=new EventHandler(userControlTimeLine_OnSuccessAnnotation); + this.userControlTimeLine.OnSuccessAnnotation += new EventHandler(userControlTimeLine_OnSuccessAnnotation); + this.userControlTimeLine.AnnotationAdded += new EventHandler(userControlTimeLine_AnnotationAdded); + this.userControlTimeLine.AnnotationRemoved += new EventHandler(userControlTimeLine_AnnotationRemoved); this.UserControlPlayer.PlayerStopOrPause +=new EventHandler(UserControlPlayer_PlayerStopOrPause); } + void userControlTimeLine_AnnotationRemoved(object sender, EventArgs e) + { + try + { + DataDictionary Data = (new DataFactory()).Data; + Data.RemoveAnnotation((Annotation)sender); + } + catch { } + } + + // Ajout Annotation + void userControlTimeLine_AnnotationAdded(object sender, EventArgs e) + { + try + { + DataDictionary Data = (new DataFactory()).Data; + Data.AddAnnotation((Annotation)sender); + } + catch { } + } + #region player private void UserControlPlayer_PlayerOpened(object sender, EventArgs e) { @@ -45,12 +69,6 @@ } - //Set a bursh color to the stack panel in the Player - public void UserControlPlayer_DisplayAnnotation(int id, Brush b) - { - UserControlPlayer.displayStackPanelAnnotations(id, b); - - } public void UserControlPlayer_PlayerStopOrPause(object sender, EventArgs e) { try @@ -105,18 +123,20 @@ { UCTimeLine.Slider.Value = UserControlPlayer.Player.Position.TotalMilliseconds; } + int SliderValue = (int)UCTimeLine.Slider.Value; if (UCTimeLine.FinishedDragging) { - int SliderValue = (int)UCTimeLine.Slider.Value; TimeSpan ts = new TimeSpan(0, 0, 0, 0, SliderValue); UserControlPlayer.Player.Position = ts; UserControlPlayer.playerPlay(); - UserControlPlayer.Time = SliderValue; + UserControlPlayer.Time = (float)SliderValue / 1000; UCTimeLine.IsDragging = false; UCTimeLine.FinishedDragging = false; } + DataDictionary Data = (new DataFactory()).Data; + UserControlPlayer.ApplyColor(Data.GetColors((int)((float)SliderValue / 1000))); } #endregion