public Delegate CreateDelegate(object instance, EventInfo event_info, FunctionObject f, object script_delegate) { Type eventHandlerType = event_info.EventHandlerType; string name = event_info.Name; for (int i = 0; i < this.registered_event_handlers.Count; i++) { EventRec rec = this.registered_event_handlers[i] as EventRec; Delegate hostDelegate = rec.HostDelegate; if ((eventHandlerType == rec.EventHandlerType) && (name == rec.EventName)) { EventRec rec2 = new EventRec(); rec2.Sender = instance; rec2.EventHandlerType = eventHandlerType; rec2.ScriptDelegate = script_delegate; rec2.HostDelegate = hostDelegate; rec2.EventName = name; this.event_rec_list.Add(rec2); return hostDelegate; } } return null; }
public void RegisterEventHandler(Type event_handler_type, string event_name, Delegate d) { EventRec rec = new EventRec(); rec.EventHandlerType = event_handler_type; rec.EventName = event_name; rec.HostDelegate = d; this.registered_event_handlers.Add(rec); }