# HG changeset patch # User sarias # Date 1253205873 -7200 # Node ID 5af0f0a8706d55fd239e7db227685e168e8315e4 # Parent bda95242e600d4e38ac24aa091f7615020031faa# Parent 99d0037234746034650ed9f2a07a419fd12639d7 Merge diff -r bda95242e600 -r 5af0f0a8706d src/FingersDance.ActionFactory/ActionGenerator.cs --- a/src/FingersDance.ActionFactory/ActionGenerator.cs Thu Sep 17 12:53:22 2009 +0200 +++ b/src/FingersDance.ActionFactory/ActionGenerator.cs Thu Sep 17 18:44:33 2009 +0200 @@ -15,12 +15,21 @@ actionDict.Add("ActionPlayMedia", typeof(FingersDance.Actions.ActionPlayMedia)); actionDict.Add("ActionShowMessage", typeof(FingersDance.Actions.ActionShowMessage)); actionDict.Add("ActionOpenMedia", typeof(FingersDance.Actions.ActionOpenMedia)); - actionDict.Add("ActionStopMedia", typeof(FingersDance.Actions.ActionStopMedia)); + actionDict.Add("ActionStopMedia", typeof(FingersDance.Actions.ActionStopMedia)); + + actionDict.Add("ActionAddAnnotation", typeof(FingersDance.Actions.ActionAddAnnotation)); } - public ActionBase GetAction(string T, object Args) + public ActionBase GetAction(String T, Object Args) { - return (ActionBase)Activator.CreateInstance(actionDict[T]); + + try + { + ActionBase ab = (ActionBase)Activator.CreateInstance(actionDict[T], Args); + return ab; + } + catch (Exception ex) { } + return null; } } } diff -r bda95242e600 -r 5af0f0a8706d src/FingersDance.Actions/ActionAddAnnotation.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/FingersDance.Actions/ActionAddAnnotation.cs Thu Sep 17 18:44:33 2009 +0200 @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +using FingersDance.Control.TimeLine; + +namespace FingersDance.Actions +{ + public class ActionAddAnnotation : FingersDance.Actions.ActionBase + { + private string _Text = ""; + private UserControlTimeLine myTimeline; + + public ActionAddAnnotation() + { + + } + + public ActionAddAnnotation(string text) + { + _Text = text; + } + + public ActionAddAnnotation(UserControlTimeLine uct) + { + myTimeline = uct; + } + + public void Execute() + { + if (myTimeline != null) + myTimeline.addAnnotation(); + } + } +} diff -r bda95242e600 -r 5af0f0a8706d src/FingersDance.Actions/FingersDance.Actions.csproj --- a/src/FingersDance.Actions/FingersDance.Actions.csproj Thu Sep 17 12:53:22 2009 +0200 +++ b/src/FingersDance.Actions/FingersDance.Actions.csproj Thu Sep 17 18:44:33 2009 +0200 @@ -60,6 +60,7 @@ + @@ -98,5 +99,11 @@ + + + {2BCEE1BF-D3AC-478C-A26B-DFDB7420E965} + FingersDance.Control.TimeLine + + \ No newline at end of file diff -r bda95242e600 -r 5af0f0a8706d src/FingersDance.Control.Menu/FingersDance.Control.Menu.csproj --- a/src/FingersDance.Control.Menu/FingersDance.Control.Menu.csproj Thu Sep 17 12:53:22 2009 +0200 +++ b/src/FingersDance.Control.Menu/FingersDance.Control.Menu.csproj Thu Sep 17 18:44:33 2009 +0200 @@ -142,6 +142,21 @@ {1E80D5A1-C45C-443B-8992-4A4D78D280FC} FingersDance.Actions + + {BE5AD2E7-8BC2-414A-AB92-34E4D7357740} + FingersDance.Control.SyncSource + + + {2BCEE1BF-D3AC-478C-A26B-DFDB7420E965} + FingersDance.Control.TimeLine + + + {4DC517DD-1601-481E-BAAC-6FE271417F46} + FingersDance.Control + + + + \ No newline at end of file diff -r bda95242e600 -r 5af0f0a8706d src/FingersDance.Control.Menu/UserControlMenu.xaml.cs --- a/src/FingersDance.Control.Menu/UserControlMenu.xaml.cs Thu Sep 17 12:53:22 2009 +0200 +++ b/src/FingersDance.Control.Menu/UserControlMenu.xaml.cs Thu Sep 17 18:44:33 2009 +0200 @@ -12,6 +12,11 @@ using System.Xml.Serialization; using System.Reflection; +using FingersDance.ActionFactory; +using FingersDance.Actions; +using FingersDance.Control.SyncSource; +using FingersDance.Control.TimeLine; + namespace FingersDance.Control.Menu { public partial class UserControlMenu @@ -19,9 +24,9 @@ public UserControlMenu() { this.InitializeComponent(); + + // Insert code required on object creation below this point. initChildSize(); - - // Insert code required on object creation below this point. } //Premet de deplacer les sous menus vers la droite pour avoir un effect tree view @@ -75,6 +80,8 @@ } else { + ItemButton.ContactDown += ActionButton_ContactDown; + ItemButton.Click += ActionButton_ContactDown; ItemButton.Action = item.Action; MItem.Children.Add(ItemButton); } @@ -86,9 +93,29 @@ } } + void ActionButton_ContactDown(object sender, RoutedEventArgs e) + { + // Generate action + // We get the instance of the user panel + UserControl userPanel = (UserControl)((Grid)((Grid)this.Parent).Parent).Parent; + // Its content... + Grid o = (Grid)userPanel.Content; + // and the UserControlSyncSource within the grid... + UserControlSyncSource syncSrc = (UserControlSyncSource)((Grid)o.Children[0]).Children[0]; + // and finally the timeline + UserControlTimeLine tl = syncSrc.userControlTimeLine; + + String actionId = ((CustomSurfaceButton)sender).Action; + ActionGenerator ag = new ActionGenerator(); + ActionBase ab = ag.GetAction(actionId, tl); + if(ab!=null) + ab.Execute(); + } + private void ButtonMenu_ContactDown(object sender, RoutedEventArgs e) { foreach (UIElement Child in ((Panel)((CustomSurfaceButton)sender).Parent).Children) + { try { if (((StackPanel)Child).Name.Equals(((Microsoft.Surface.Presentation.Controls.SurfaceButton)sender).Content.ToString().Replace(' ', '_') + "Panel")) @@ -105,6 +132,7 @@ } } catch (Exception ex) { } + } } #region Events diff -r bda95242e600 -r 5af0f0a8706d src/FingersDance.Control.Player/UserControlPlayer.xaml.cs --- a/src/FingersDance.Control.Player/UserControlPlayer.xaml.cs Thu Sep 17 12:53:22 2009 +0200 +++ b/src/FingersDance.Control.Player/UserControlPlayer.xaml.cs Thu Sep 17 18:44:33 2009 +0200 @@ -59,7 +59,7 @@ //DirectoryInfo info = Directory.GetParent(@"."); FileInfo assemblyPath = new FileInfo(Assembly.GetExecutingAssembly().Location); DirectoryInfo info = assemblyPath.Directory; - MediaElementVideo.Source = new Uri(@"" + info.FullName.ToString() + "\\Resources\\Lake.wmv", UriKind.Relative); + MediaElementVideo.Source = new Uri(@"" + info.FullName.ToString() + "\\Resources\\oneflat.wmv", UriKind.Relative); MediaElementVideo.LoadedBehavior = MediaState.Manual; MediaElementVideo.UnloadedBehavior = MediaState.Manual; MediaElementVideo.ScrubbingEnabled= true; diff -r bda95242e600 -r 5af0f0a8706d src/FingersDance.Control.SyncSource/UserControlSyncSource.xaml --- a/src/FingersDance.Control.SyncSource/UserControlSyncSource.xaml Thu Sep 17 12:53:22 2009 +0200 +++ b/src/FingersDance.Control.SyncSource/UserControlSyncSource.xaml Thu Sep 17 18:44:33 2009 +0200 @@ -11,7 +11,7 @@ - + diff -r bda95242e600 -r 5af0f0a8706d src/FingersDance.Control.SyncSource/UserControlSyncSource.xaml.cs --- a/src/FingersDance.Control.SyncSource/UserControlSyncSource.xaml.cs Thu Sep 17 12:53:22 2009 +0200 +++ b/src/FingersDance.Control.SyncSource/UserControlSyncSource.xaml.cs Thu Sep 17 18:44:33 2009 +0200 @@ -25,11 +25,11 @@ private void UserControlPlayer_PlayerOpened(object sender, EventArgs e) { //Initialisation du Timer - UserControlTimeLine.initTimer(); + UCTimeLine.initTimer(); //Initialisation du slider - UserControlTimeLine.initslider(UserControlPlayer.TotalMilliseconds); + UCTimeLine.initslider(UserControlPlayer.TotalMilliseconds); //Demarrage du Timer - UserControlTimeLine.timerStart(); + UCTimeLine.timerStart(); } #endregion @@ -52,22 +52,27 @@ #region SynSource pour chaque X milliseconds private void UserControlTimeLine_TimerTick(object sender, EventArgs e) { - if (!UserControlTimeLine.IsDragging) + if (!UCTimeLine.IsDragging) { - UserControlTimeLine.Slider.Value = UserControlPlayer.Player.Position.TotalMilliseconds; + UCTimeLine.Slider.Value = UserControlPlayer.Player.Position.TotalMilliseconds; } - if (UserControlTimeLine.FinishedDragging) + if (UCTimeLine.FinishedDragging) { - int SliderValue = (int)UserControlTimeLine.Slider.Value; + int SliderValue = (int)UCTimeLine.Slider.Value; TimeSpan ts = new TimeSpan(0, 0, 0, 0, SliderValue); UserControlPlayer.Player.Position = ts; UserControlPlayer.playerPlay(); - UserControlTimeLine.IsDragging = false; - UserControlTimeLine.FinishedDragging = false; + UCTimeLine.IsDragging = false; + UCTimeLine.FinishedDragging = false; } } #endregion + + public UserControlTimeLine userControlTimeLine + { + get { return this.UCTimeLine; } + } } } \ No newline at end of file diff -r bda95242e600 -r 5af0f0a8706d src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml --- a/src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml Thu Sep 17 12:53:22 2009 +0200 +++ b/src/FingersDance.Control.TimeLine/UserControlTimeLine.xaml Thu Sep 17 18:44:33 2009 +0200 @@ -7,10 +7,12 @@ 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"> + d:DesignWidth="383" xmlns:Custom="http://schemas.microsoft.com/surface/2008" Background="{x:Null}" d:DesignHeight="33"> - - + + \ No newline at end of file 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 diff -r bda95242e600 -r 5af0f0a8706d src/FingersDance.Views/TimelineAnnotationView.xaml --- a/src/FingersDance.Views/TimelineAnnotationView.xaml Thu Sep 17 12:53:22 2009 +0200 +++ b/src/FingersDance.Views/TimelineAnnotationView.xaml Thu Sep 17 18:44:33 2009 +0200 @@ -8,12 +8,14 @@ x:Class="FingersDance.Views.TimelineAnnotationView" xmlns:vw="clr-namespace:FingersDance.Views" x:Name="UserControl" - d:DesignWidth="640" d:DesignHeight="480"> + d:DesignWidth="640" d:DesignHeight="480" Width="40"> - - + + + + \ No newline at end of file diff -r bda95242e600 -r 5af0f0a8706d src/FingersDance.Views/TimelineAnnotationView.xaml.cs --- a/src/FingersDance.Views/TimelineAnnotationView.xaml.cs Thu Sep 17 12:53:22 2009 +0200 +++ b/src/FingersDance.Views/TimelineAnnotationView.xaml.cs Thu Sep 17 18:44:33 2009 +0200 @@ -31,7 +31,8 @@ { ThicknessConverter myThicknessConverter = new ThicknessConverter(); Thickness th1 = (Thickness)myThicknessConverter.ConvertFrom(value); - th1.Top = th1.Top; + th1.Top = 0; + th1.Bottom = th1.Right = 0; return th1; } public object ConvertBack(object value, Type targetTypes, object parameter, System.Globalization.CultureInfo culture) diff -r bda95242e600 -r 5af0f0a8706d src/FingersDance.Views/TimelineView.xaml --- a/src/FingersDance.Views/TimelineView.xaml Thu Sep 17 12:53:22 2009 +0200 +++ b/src/FingersDance.Views/TimelineView.xaml Thu Sep 17 18:44:33 2009 +0200 @@ -2,13 +2,10 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:vw="clr-namespace:FingersDance.Views" - Height="300" Width="300"> + > - - - + @@ -36,5 +33,6 @@ + diff -r bda95242e600 -r 5af0f0a8706d src/FingersDance/FingersDance.csproj --- a/src/FingersDance/FingersDance.csproj Thu Sep 17 12:53:22 2009 +0200 +++ b/src/FingersDance/FingersDance.csproj Thu Sep 17 18:44:33 2009 +0200 @@ -128,6 +128,9 @@ Always + + Always + diff -r bda95242e600 -r 5af0f0a8706d src/FingersDance/Resources/menu.xml --- a/src/FingersDance/Resources/menu.xml Thu Sep 17 12:53:22 2009 +0200 +++ b/src/FingersDance/Resources/menu.xml Thu Sep 17 18:44:33 2009 +0200 @@ -65,16 +65,16 @@ Choregraphique - ChildChore1 + Saut 1 FingersDanceAnnotationButtonNiveau3 - ChildChore1 + ActionAddAnnotation - ChildChore2 + Pirouette 2 FingersDanceAnnotationButtonNiveau3 - ChildChore2 + ActionAddAnnotation FingersDanceAnnotationButtonNiveau2