# HG changeset patch # User PAMPHILE Jonathan # Date 1253042391 -7200 # Node ID cbe5b01679a36785c38652919c11fa02797eaac1 # Parent 9e2f007b19b368446c0cf3de44b2990d1fc69004 Création du CustomSurfaceButton diff -r 9e2f007b19b3 -r cbe5b01679a3 src/FingersDance.Control.Menu/CustomSurfaceButton.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/FingersDance.Control.Menu/CustomSurfaceButton.cs Tue Sep 15 21:19:51 2009 +0200 @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Microsoft.Surface; +using Microsoft.Surface.Presentation; +using Microsoft.Surface.Presentation.Controls; + +namespace FingersDance.Control.Menu +{ + public class CustomSurfaceButton:SurfaceButton + { + string _Action = ""; + string _Ressource = ""; + + public string Action + { + get { return _Action; } + set { _Action = value; } + } + + public string Ressource + { + get { return _Ressource; } + set { _Ressource = value; } + } + + public CustomSurfaceButton() + { + this.ContactDown += GenerateAction; + this.Click += GenerateAction; + } + + private void GenerateAction(Object sender, EventArgs Event) + { + try + { + ActionFactory.ActionGenerator AG = (new ActionFactory.ActionFactory()).GetGenerator(); + FingersDance.Actions.ActionBase action = AG.GetAction("Action" + ((CustomSurfaceButton)sender).Content, null); + if (action != null) + { + //action.Execute(); + //this.debug.addToList(action.GetType().ToString()); + } + } + catch (Exception e) { } + } + } +} diff -r 9e2f007b19b3 -r cbe5b01679a3 src/FingersDance.Control.Menu/FingersDance.Control.Menu.csproj --- a/src/FingersDance.Control.Menu/FingersDance.Control.Menu.csproj Tue Sep 15 18:20:09 2009 +0200 +++ b/src/FingersDance.Control.Menu/FingersDance.Control.Menu.csproj Tue Sep 15 21:19:51 2009 +0200 @@ -88,6 +88,7 @@ + diff -r 9e2f007b19b3 -r cbe5b01679a3 src/FingersDance.Control.Menu/UserControlMenu.xaml --- a/src/FingersDance.Control.Menu/UserControlMenu.xaml Tue Sep 15 18:20:09 2009 +0200 +++ b/src/FingersDance.Control.Menu/UserControlMenu.xaml Tue Sep 15 21:19:51 2009 +0200 @@ -17,10 +17,5 @@ - - - - - \ No newline at end of file diff -r 9e2f007b19b3 -r cbe5b01679a3 src/FingersDance.Control.Menu/UserControlMenu.xaml.cs --- a/src/FingersDance.Control.Menu/UserControlMenu.xaml.cs Tue Sep 15 18:20:09 2009 +0200 +++ b/src/FingersDance.Control.Menu/UserControlMenu.xaml.cs Tue Sep 15 21:19:51 2009 +0200 @@ -54,7 +54,7 @@ try { StackPanel MItem = new StackPanel(); - Microsoft.Surface.Presentation.Controls.SurfaceButton ItemButton = new Microsoft.Surface.Presentation.Controls.SurfaceButton(); + CustomSurfaceButton ItemButton = new CustomSurfaceButton(); ItemButton.Content = item.Name; if (item.Items.Count > 0) { @@ -75,8 +75,9 @@ } else { - ItemButton.ContactDown += GenerateAction; - ItemButton.Click += GenerateAction; + ItemButton.Action = item.Action; + //ItemButton.ContactDown += GenerateAction; + //ItemButton.Click += GenerateAction; MItem.Children.Add(ItemButton); } return MItem; @@ -86,7 +87,10 @@ throw ex; } } - + + /* + * Déplacé dans le CustomSurfaceButton + private void GenerateAction(Object sender, RoutedEventArgs Event) { try @@ -101,10 +105,13 @@ } catch (Exception e) { } } + + * + */ private void ButtonMenu_ContactDown(object sender, RoutedEventArgs e) { - foreach (UIElement Child in ((Panel)((Microsoft.Surface.Presentation.Controls.SurfaceButton)sender).Parent).Children) + foreach (UIElement Child in ((Panel)((CustomSurfaceButton)sender).Parent).Children) try { if (((StackPanel)Child).Name.Equals(((Microsoft.Surface.Presentation.Controls.SurfaceButton)sender).Content + "Panel"))