public RubyEvent(object/*!*/ target, RubyEventInfo/*!*/ info, string/*!*/ name) { ContractUtils.RequiresNotNull(target, "target"); ContractUtils.RequiresNotNull(info, "info"); ContractUtils.RequiresNotNull(name, "name"); _target = target; _info = info; _name = name; }
private bool TryGetClrEvent(Type/*!*/ type, BindingFlags bindingFlags, bool inherited, string/*!*/ name, out RubyMemberInfo method) { Assert.NotNull(type, name); EventInfo eventInfo; if (inherited) { eventInfo = type.GetInheritedEvents(name).WithBindingFlags(bindingFlags).FirstOrDefault(); } else { eventInfo = type.GetDeclaredEvent(name).WithBindingFlags(bindingFlags); } if (eventInfo != null) { // creates detached info if only declared members are requested (used by Kernel#clr_member): method = new RubyEventInfo((EventTracker)MemberTracker.FromMemberInfo(eventInfo), RubyMemberFlags.Public, this, isDetached: inherited); return true; } method = null; return false; }
private bool TryGetClrEvent(Type/*!*/ type, BindingFlags bindingFlags, string/*!*/ name, out RubyMemberInfo method) { Assert.NotNull(type, name); EventInfo eventInfo = type.GetEvent(name, bindingFlags); if (eventInfo != null) { // creates detached info if only declared members are requested (used by Kernel#clr_member): bool createDetached = (bindingFlags & BindingFlags.DeclaredOnly) != 0; method = new RubyEventInfo((EventTracker)MemberTracker.FromMemberInfo(eventInfo), RubyMemberFlags.Public, this, createDetached); return true; } method = null; return false; }
public static RubyEvent/*!*/ CreateEvent(RubyEventInfo/*!*/ eventInfo, object/*!*/ target, string/*!*/ name) { return new RubyEvent(target, eventInfo, name); }
public static Proc/*!*/ HookupEvent(RubyEventInfo/*!*/ eventInfo, object/*!*/ target, Proc/*!*/ proc) { eventInfo.Tracker.AddHandler(target, proc, eventInfo.Context); return proc; }
private bool TryGetClrEvent(Type/*!*/ type, BindingFlags bindingFlags, string/*!*/ name, out RubyMemberInfo method) { Assert.NotNull(type, name); EventInfo eventInfo = type.GetEvent(name, bindingFlags); if (eventInfo != null) { method = new RubyEventInfo((EventTracker)MemberTracker.FromMemberInfo(eventInfo), RubyMemberFlags.Public, this); return true; } method = null; return false; }