示例#1
0
        public EventProxy(
            IEventAggregator <TProxyEvent> eventAggregator,
            string hubUrl,
            Action <IHubConnection> configureConnection,
            Action <Exception> faultedConnectingAction,
            Action <Exception, IList <Subscription> > faultedSubscriptionActionm,
            Action connectedAction)
        {
            typeFinder        = new TypeFinder <TProxyEvent>();
            subscriptionQueue = new List <Subscription>();

            this.eventAggregator           = eventAggregator;
            this.faultedConnectingAction   = faultedConnectingAction;
            this.faultedSubscriptionAction = faultedSubscriptionActionm;
            this.connectedAction           = connectedAction;

            throttleHandler = DependencyResolver.Global.Get <ISubscriptionThrottleHandler>();
            throttleHandler.Init(() => SendQueuedSubscriptions());
            subscriptionStore = DependencyResolver.Global.Get <ISubscriptionStore>();
            proxy             = DependencyResolver.Global.Get <IHubProxyFactory>()
                                .Create(hubUrl, configureConnection, p =>
            {
                SendQueuedSubscriptions();
                p.On <Message>("onEvent", OnEvent);
            },
                                        Reconnected, FaultedConnection, ConnectionComplete);
        }
示例#2
0
        public EventProxy(IHubProxyFactory hubProxyFactory, ISubscriptionThrottleHandler throttleHandler, ISubscriptionStore subscriptionStore, ITypeFinder typeFinder)
        {
            this.typeFinder   = typeFinder;
            subscriptionQueue = new List <Subscription>();

            this.hubProxyFactory = hubProxyFactory;

            this.throttleHandler = throttleHandler;
            throttleHandler.Init(() => SendQueuedSubscriptions());
            this.subscriptionStore = subscriptionStore;
        }