示例#1
0
文件: R3.cs 项目: Mechami/router
 /// \brief Constructor that accepts a Component, a RoutePointer<R, T1, T2, T3> and a RoutingEvent.
 /// \warning Do not pass null as any parameters.\n
 /// \warning Router will discard any Routes with null attributes.
 public Route(Component RouteSubscriber /**< Reference to the subscribing Component.\n Can be of any type derived from Component. */, RoutePointer <R, T1, T2, T3> RoutingAddress /**< Reference to a function that this route calls.\n R is return type while T1, T2 and T3 are parameter types. */, RoutingEvent Event /**< Value stating which event calls this Route. */) : this()
 {
     Subscriber = RouteSubscriber;
     Address    = (RoutingAddress != null)? (RoutePointer <R, T1, T2, T3>)(RoutingAddress.GetInvocationList()[0]) : null;
     RouteEvent = Event;
     IsValid    = ((this.Subscriber != null) && (this.Address != null) && (this.RouteEvent != RoutingEvent.Null));
 }
示例#2
0
文件: Base.cs 项目: Mechami/router
        /// \brief Constructor that accepts a Component, a RoutePointer and a RoutingEvent.
        /// \warning Do not pass null as any parameters.\n
        /// \warning Router will discard any Routes with null attributes.
        public Route(Component RouteSubscriber /**< Reference to the subscribing Component.\n Can be of any type derived from Component. */, RoutePointer RoutingAddress /**< Reference to a function that this route calls.\n Must return void and accept no parameters. */, RoutingEvent Event /**< Value stating which event calls this Route. */) : this()
        {
            Subscriber = RouteSubscriber;
            RouteEvent = Event;

            Address = (RoutingAddress != null)?
                      (RoutePointer)(RoutingAddress.GetInvocationList()[0]) :
                      null;

            IsValid = (this.Subscriber != null) &&
                      (this.Address != null) &&
                      (((Component)this.Address.Target) == this.Subscriber) &&
                      (this.RouteEvent != RoutingEvent.Null);
        }