Пример #1
0
 public ExceptionEventBusEventArgs(Exception exceptionData, EventBusSubscriptionToken token, object sender, IEventBusEventArgs eventData)
 {
     ExceptionData = exceptionData ?? throw new ArgumentNullException(nameof(exceptionData));
     Token         = token ?? throw new ArgumentNullException(nameof(token));
     Sender        = sender;
     EventData     = eventData ?? throw new ArgumentNullException(nameof(eventData));
 }
        /// <summary>
        /// Unsubscribe from the Event type related to the specified <see cref="EventBusSubscriptionToken"/>
        /// </summary>
        /// <param name="bus">The event bus to unsubscribe from.</param>
        /// <param name="token">The <see cref="EventBusSubscriptionToken"/> received from calling the Subscribe method</param>
        /// <returns>Indicates if a subscription was removed (if token actually was registered)</returns>
        public static bool Unsubscribe(this IEventBus bus, EventBusSubscriptionToken token)
        {
            if (bus == null)
            {
                throw new ArgumentNullException(nameof(bus));
            }
            if (token == null)
            {
                throw new ArgumentNullException(nameof(token));
            }

            return(token.Unsubscribe());
        }
Пример #3
0
 public EventBusSubscription(EventHandler <TEventType> eventReference, EventBusSubscriptionToken token)
 {
     EventReference = eventReference ?? throw new ArgumentNullException(nameof(eventReference));
     Token          = token ?? throw new ArgumentNullException(nameof(token));
 }