Exemplo n.º 1
0
        public MainShellViewModel(IProxyEventAggregator eventAggregator, SendMessageViewModel sendMessage)
        {
            SendMessage = sendMessage;
            DisplayName = ".NET Client Demo";


            Events = new BindableCollection <IMessageEvent <string> >();

            eventAggregator.Subscribe(this, builder => builder.For <ConstrainedEvent>().Add(new ConstrainedEventConstraint {
                Message = "HelloWorld"
            }));
        }
Exemplo n.º 2
0
        public async Task Init(string hubUrl, IProxyEventAggregator eventAggregator, Action <HubConnection> configureConnection, Action <Exception> faultedConnectingAction, Action <Exception, IList <Subscription> > faultedSubscriptionAction, Action connectedAction)
        {
            this.eventAggregator           = eventAggregator;
            this.faultedConnectingAction   = faultedConnectingAction;
            this.faultedSubscriptionAction = faultedSubscriptionAction;
            this.connectedAction           = connectedAction;

            await hubProxyFactory
            .Create(hubUrl, configureConnection, async p =>
            {
                proxy = p;
                await SendQueuedSubscriptions();
                p.On <Message>("onEvent", OnEvent);
            },
                    Reconnected, FaultedConnection, ConnectionComplete);
        }
 public void ConfigureProxy(EventProxy eventProxy, IProxyEventAggregator eventAggregator)
 {
     Task.Run(() => eventProxy.Init(hubUrl, eventAggregator, configureConnection, faultedConnectingAction, faultedSubscriptionAction, connectedAction));
 }