src/FingersDance.Control.Menu/CustomSurfaceButton.cs
changeset 62 cbe5b01679a3
child 81 6b991b7e8046
--- /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) { }
+        }
+    }
+}