public PropertyPublication( IEventTopicExecuter topic, object publisher, EventInfo eventInfo, HandlerRestriction handlerRestriction, IList<IPublicationMatcher> publicationMatchers) : base(topic, publisher, handlerRestriction, publicationMatchers) { this.eventInfo = eventInfo; if (this.eventInfo.EventHandlerType == null) { throw new EventBrokerException("EventHandlerType on published event must not be null (internal EventBroker failure)."); } ThrowIfInvalidEventHandler(this.eventInfo); ThrowIfEventIsStatic(this.eventInfo); this.eventArgsType = this.eventInfo.EventHandlerType == typeof(EventHandler) ? typeof(EventArgs) : this.eventInfo.EventHandlerType.GetGenericArguments()[0]; Delegate handler = Delegate.CreateDelegate( this.eventInfo.EventHandlerType, this, this.GetType().GetMethod("PublicationHandler")); this.eventInfo.AddEventHandler(publisher, handler); }
public PropertyPublication( IEventTopicExecuter topic, object publisher, EventInfo eventInfo, HandlerRestriction handlerRestriction, IList <IPublicationMatcher> publicationMatchers) : base(topic, publisher, handlerRestriction, publicationMatchers) { this.eventInfo = eventInfo; if (this.eventInfo.EventHandlerType == null) { throw new EventBrokerException("EventHandlerType on published event must not be null (internal EventBroker failure)."); } ThrowIfInvalidEventHandler(this.eventInfo); ThrowIfEventIsStatic(this.eventInfo); this.eventArgsType = this.eventInfo.EventHandlerType == typeof(EventHandler) ? typeof(EventArgs) : this.eventInfo.EventHandlerType.GetGenericArguments()[0]; Delegate handler = Delegate.CreateDelegate( this.eventInfo.EventHandlerType, this, this.GetType().GetMethod("PublicationHandler")); this.eventInfo.AddEventHandler(publisher, handler); }
/// <summary> /// Creates a new publication /// </summary> /// <param name="eventTopic">The event topic.</param> /// <param name="publisher">The publisher.</param> /// <param name="eventInfo">The event info.</param> /// <param name="handlerRestriction">The handler restriction.</param> /// <param name="publicationMatchers">The publication matchers.</param> /// <returns>A newly created publication</returns> public virtual IPublication CreatePublication( IEventTopicExecuter eventTopic, object publisher, EventInfo eventInfo, HandlerRestriction handlerRestriction, IList <IPublicationMatcher> publicationMatchers) { return(new PropertyPublication(eventTopic, publisher, eventInfo, handlerRestriction, publicationMatchers)); }
/// <summary> /// Creates a new publication. /// </summary> /// <typeparam name="TEventArgs">The type of the event arguments.</typeparam> /// <param name="eventTopic">The event topic.</param> /// <param name="publisher">The publisher.</param> /// <param name="eventHandler">The event handler.</param> /// <param name="handlerRestriction">The handler restriction.</param> /// <param name="publicationMatchers">The matchers.</param> /// <returns>A newly created publication</returns> public virtual IPublication CreatePublication <TEventArgs>( IEventTopicExecuter eventTopic, object publisher, ref EventHandler <TEventArgs> eventHandler, HandlerRestriction handlerRestriction, IList <IPublicationMatcher> publicationMatchers) where TEventArgs : EventArgs { return(new CodePublication <TEventArgs>(eventTopic, publisher, ref eventHandler, handlerRestriction, publicationMatchers)); }
protected Publication( IEventTopicExecuter topic, object publisher, HandlerRestriction handlerRestriction, IList <IPublicationMatcher> publicationMatchers) { this.topic = topic; this.publisher = new WeakReference(publisher); this.handlerRestriction = handlerRestriction; this.publicationMatchers = publicationMatchers; }
protected Publication( IEventTopicExecuter topic, object publisher, HandlerRestriction handlerRestriction, IList<IPublicationMatcher> publicationMatchers) { this.topic = topic; this.publisher = new WeakReference(publisher); this.handlerRestriction = handlerRestriction; this.publicationMatchers = publicationMatchers; }
public CodePublication( IEventTopicExecuter topic, object publisher, ref EventHandler <TEventArgs> eventHandler, HandlerRestriction handlerRestriction, IList <IPublicationMatcher> publicationMatchers) : base(topic, publisher, handlerRestriction, publicationMatchers) { eventHandler += this.PublicationHandler; this.eventArgsType = eventHandler.GetType().GetGenericArguments()[0]; }
public CodePublication( IEventTopicExecuter topic, object publisher, ref EventHandler eventHandler, HandlerRestriction handlerRestriction, IList <IPublicationMatcher> publicationMatchers) : base(topic, publisher, handlerRestriction, publicationMatchers) { eventHandler += this.PublicationHandler; this.eventArgsType = typeof(EventArgs); }
public SpontaneousPublication(IEventTopicExecuter topic, object publisher, Type eventArgsType, HandlerRestriction handlerRestriction, IList<IPublicationMatcher> publicationMatchers) : base(topic, publisher, handlerRestriction, publicationMatchers) { this.eventArgsType = eventArgsType; }
public SpontaneousPublication(IEventTopicExecuter topic, object publisher, Type eventArgsType, HandlerRestriction handlerRestriction, IList <IPublicationMatcher> publicationMatchers) : base(topic, publisher, handlerRestriction, publicationMatchers) { this.eventArgsType = eventArgsType; }