Esempio n. 1
0
        private static T GetAs <T>(this ISignalREvent @event, ISignalREventHandler handler, string key, T defaultValue)
        {
            var theValue = @event.Get(handler, key, defaultValue);

            if (theValue == null)
            {
                return(defaultValue);
            }
            return((T)Convert.ChangeType(theValue, typeof(T)));
        }
Esempio n. 2
0
        //helpers
        private static void Set(this ISignalREvent @event, ISignalREventHandler handler, string key, object value)
        {
            if (@event == null)
            {
                throw new ArgumentNullException(nameof(@event));
            }

            if (handler == null)
            {
                throw new ArgumentNullException(nameof(handler));
            }
            var theKey = string.Format("{0}_{1}", key, handler.GetType().FullName);

            @event.Bags[theKey] = value;
        }
Esempio n. 3
0
        private static object Get(this ISignalREvent @event, ISignalREventHandler handler, string key, object defaultValue)
        {
            if (@event == null)
            {
                throw new ArgumentNullException(nameof(@event));
            }

            if (handler == null)
            {
                throw new ArgumentNullException(nameof(handler));
            }

            var theKey = string.Format("{0}_{1}", key, handler.GetType().FullName);

            if ([email protected](theKey))
            {
                return(defaultValue);
            }
            return(@event.Bags[theKey]);
        }
Esempio n. 4
0
 public static bool GetStopSend(this ISignalREvent @event, ISignalREventHandler handler, bool defaultValue)
 {
     return(@event.GetAs(handler, ShouldStopSend, defaultValue));
 }
Esempio n. 5
0
 public static void SetStopSend(this ISignalREvent @event, ISignalREventHandler handler, bool shouldStop)
 {
     @event.Set(handler, ShouldStopSend, shouldStop);
 }
Esempio n. 6
0
 public static void SetShouldThrowWhenException(this ISignalREvent @event, ISignalREventHandler handler, bool shouldThrow)
 {
     @event.Set(handler, ShouldThrowWhenException, shouldThrow);
 }
Esempio n. 7
0
 public static bool GetShouldThrowWhenException(this ISignalREvent @event, ISignalREventHandler handler, bool defaultValue)
 {
     return(@event.GetAs(handler, ShouldThrowWhenException, defaultValue));
 }
Esempio n. 8
0
 public static void SetShouldWaitComplete(this ISignalREvent @event, ISignalREventHandler handler, bool shouldWait)
 {
     @event.Set(handler, ShouldWaitComplete, shouldWait);
 }
Esempio n. 9
0
 public static bool GetShouldWaitComplete(this ISignalREvent @event, ISignalREventHandler handler, bool defaultValue)
 {
     return(@event.GetAs(handler, ShouldWaitComplete, defaultValue));
 }
Esempio n. 10
0
 public SignalREventHandlerDecorator(ISignalREventHandler signalREventHandler)
 {
     _signalREventHandler = signalREventHandler;
 }