diff options
-rw-r--r-- | CSharp/Ivy/IvyPPC/Ivy.cs | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/CSharp/Ivy/IvyPPC/Ivy.cs b/CSharp/Ivy/IvyPPC/Ivy.cs index cc4dd5f..cded94b 100644 --- a/CSharp/Ivy/IvyPPC/Ivy.cs +++ b/CSharp/Ivy/IvyPPC/Ivy.cs @@ -27,8 +27,29 @@ namespace IvyBus /// <summary> The Main bus Class
/// </summary>
///
+
+#if (PocketPC)
+ public class CreateDelegate
+ {
+ object eventtarget;
+ MethodInfo mymethod;
+ object [] methodparams = new Object[2];
+ public void Invoke(object sender, System.EventArgs e)
+ {
+ methodparams[1] = e;
+ mymethod.Invoke(eventtarget, methodparams);
+ }
+ public CreateDelegate(MethodInfo mi, object eventTarget, object eventObject)
+ {
+ eventtarget = eventTarget;
+ mymethod = mi;
+ methodparams[0] = eventObject;
+ methodparams[1] = null;
+ }
+ }
+#endif
#if (!PocketPC)
[ToolboxItemFilter("System.Windows.Forms.Form",ToolboxItemFilterType.Allow)]
@@ -350,13 +371,16 @@ namespace IvyBus public void AutoBinding(Type type)
{
//Get instance of the IvyBindingAttribute.
- foreach (MethodInfo m in type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic))
+ foreach (MethodInfo m in type.GetMethods( BindingFlags.Static | BindingFlags.NonPublic))
{
foreach (IvyBindingAttribute attr in Attribute.GetCustomAttributes(m, typeof(IvyBindingAttribute)))
{
//TODO check paramater type MessageHandler
Debug.WriteLine("IvyBinding '" + attr.GetExpression(null) + "' to Method " + m.Name);
-#if (!PocketPC)
+#if (PocketPC)
+ //bindMsg(attr.GetExpression(null), (MessageHandler) DynamicMethod.CreateDelegate(m));
+
+#else
bindMsg(attr.GetExpression(null), (MessageHandler)Delegate.CreateDelegate(typeof(MessageHandler),m));
#endif
}
@@ -367,13 +391,15 @@ namespace IvyBus {
Type type = obj.GetType();
//Get instance of the IvyBindingAttribute.
- foreach (MethodInfo m in type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic))
+ foreach (MethodInfo m in type.GetMethods(BindingFlags.Instance | BindingFlags.NonPublic))
{
foreach (IvyBindingAttribute attr in Attribute.GetCustomAttributes(m, typeof(IvyBindingAttribute)))
{
//TODO check paramater type MessageHandler
traceDebug("IvyBinding '" + attr.GetExpression(obj) + "' to Method " + m.Name);
-#if (!PocketPC)
+#if (PocketPC)
+ //bindMsg(attr.GetExpression(obj), (MessageHandler) new CreateDelegate( m, obj, null));
+#else
bindMsg(attr.GetExpression(obj), (MessageHandler)Delegate.CreateDelegate(typeof(MessageHandler), obj, m));
#endif
}
|