diff options
Diffstat (limited to 'src/Interface.cs')
| -rw-r--r-- | src/Interface.cs | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/Interface.cs b/src/Interface.cs index 69e8d9d0..9b6e3dc8 100644 --- a/src/Interface.cs +++ b/src/Interface.cs @@ -175,14 +175,21 @@ namespace go MethodInfo mi = hostClass.GetType ().GetMethod (es.Value, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); + object effectiveHostClass = hostClass; if (mi == null) { - Debug.WriteLine ("Handler Method not found: " + es.Value); - continue; + //TODO: hack to have it work, hostClass and dataSource should be clearly separated + mi = OpenTKGameWindow.currentWindow.GetType ().GetMethod (es.Value, BindingFlags.NonPublic | BindingFlags.Public + | BindingFlags.Instance); + if (mi == null) { + Debug.WriteLine ("Handler Method not found: " + es.Value); + continue; + } + effectiveHostClass = OpenTKGameWindow.currentWindow; } EventInfo ei = es.Source.GetType ().GetEvent (es.MemberName); MethodInfo addHandler = ei.GetAddMethod (); - Delegate del = Delegate.CreateDelegate (ei.EventHandlerType, hostClass, mi); + Delegate del = Delegate.CreateDelegate (ei.EventHandlerType, effectiveHostClass, mi); addHandler.Invoke(es.Source, new object[] {del}); |