From 63d9f7f20d96a961c021b8bb6d102dfa12e38636 Mon Sep 17 00:00:00 2001 From: fcolin Date: Thu, 1 Feb 2007 09:43:38 +0000 Subject: Utilisateur : Fcolin Date : 8/02/06 Heure : 11:45 Archivé dans $/CSharp/Ivy/IvyPPC Commentaire: (vss 51) --- CSharp/Ivy/Ivy/Ivy.cs | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/CSharp/Ivy/Ivy/Ivy.cs b/CSharp/Ivy/Ivy/Ivy.cs index cc4dd5f..cded94b 100644 --- a/CSharp/Ivy/Ivy/Ivy.cs +++ b/CSharp/Ivy/Ivy/Ivy.cs @@ -27,8 +27,29 @@ namespace IvyBus /// The Main bus Class /// /// + +#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 } -- cgit v1.1