Custom Surface Button
authorPAMPHILE Jonathan <pamphile@efrei.fr>
Wed, 23 Sep 2009 12:01:23 +0200
changeset 81 6b991b7e8046
parent 80 605e2e2e053f
child 83 841de52a9f83
Custom Surface Button
src/FingersDance.Control.Menu/CustomSurfaceButton.cs
src/FingersDance.Control.Menu/UserControlMenu.xaml
src/FingersDance.Control.Menu/UserControlMenu.xaml.cs
--- a/src/FingersDance.Control.Menu/CustomSurfaceButton.cs	Wed Sep 23 09:59:30 2009 +0200
+++ b/src/FingersDance.Control.Menu/CustomSurfaceButton.cs	Wed Sep 23 12:01:23 2009 +0200
@@ -26,24 +26,6 @@
         }
 
         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) { }
-        }
+        { }
     }
 }
--- a/src/FingersDance.Control.Menu/UserControlMenu.xaml	Wed Sep 23 09:59:30 2009 +0200
+++ b/src/FingersDance.Control.Menu/UserControlMenu.xaml	Wed Sep 23 12:01:23 2009 +0200
@@ -468,7 +468,5 @@
         </Style>
     </UserControl.Resources>
 
-    <StackPanel x:Name="LayoutRoot" Width="Auto" Height="Auto" Background="{x:Null}">
-
-    </StackPanel>
+    <StackPanel x:Name="LayoutRoot" Width="Auto" Height="Auto" Background="{x:Null}"/>
 </UserControl>
\ No newline at end of file
--- a/src/FingersDance.Control.Menu/UserControlMenu.xaml.cs	Wed Sep 23 09:59:30 2009 +0200
+++ b/src/FingersDance.Control.Menu/UserControlMenu.xaml.cs	Wed Sep 23 12:01:23 2009 +0200
@@ -66,6 +66,7 @@
                  {
                      ItemButton.ContactDown += ButtonMenu_ContactDown;
                      ItemButton.Click += ButtonMenu_ContactDown;
+                     ItemButton.ContactHoldGesture += new ContactEventHandler(ItemButton_ContactHoldGesture);
                      MItem.Children.Add(ItemButton);
                      StackPanel Temp = new StackPanel();
                      foreach (Item elt in item.Items)
@@ -93,6 +94,11 @@
              }
          }
 
+         void ItemButton_ContactHoldGesture(object sender, ContactEventArgs e)
+         {
+             MessageBox.Show(((CustomSurfaceButton)sender).Action);
+         }
+
          void ActionButton_ContactDown(object sender, RoutedEventArgs e)
          {
              // Generate action
@@ -135,6 +141,11 @@
              }
          }
 
+         private void LayoutRoot_DragLeave(object sender, System.Windows.DragEventArgs e)
+         {
+             MessageBox.Show(((CustomSurfaceButton)sender).Action);
+         }
+
         #region Events
 
      /*