diff -r 7ce946833eae -r 99d003723474 src/FingersDance.Control.Menu/UserControlMenu.xaml.cs --- a/src/FingersDance.Control.Menu/UserControlMenu.xaml.cs Thu Sep 17 13:06:22 2009 +0200 +++ b/src/FingersDance.Control.Menu/UserControlMenu.xaml.cs Thu Sep 17 17:25:05 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