summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfcolin2007-02-01 09:43:38 +0000
committerfcolin2007-02-01 09:43:38 +0000
commit63d9f7f20d96a961c021b8bb6d102dfa12e38636 (patch)
tree927f2acfbf8a6c9c818260d9dd7d441b03393c1d
parent015858b5ec40d4a07c453f7e75f71ef88fa309ed (diff)
downloadivy-csharp-63d9f7f20d96a961c021b8bb6d102dfa12e38636.zip
ivy-csharp-63d9f7f20d96a961c021b8bb6d102dfa12e38636.tar.gz
ivy-csharp-63d9f7f20d96a961c021b8bb6d102dfa12e38636.tar.bz2
ivy-csharp-63d9f7f20d96a961c021b8bb6d102dfa12e38636.tar.xz
Utilisateur : Fcolin Date : 8/02/06 Heure : 11:45 Archivé dans $/CSharp/Ivy/IvyPPC Commentaire: (vss 51)
-rw-r--r--CSharp/Ivy/Ivy/Ivy.cs34
1 files 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
/// <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
}