Exemplo n.º 1
0
        private void InitHubEvents()
        {
            _hubConnection.On <string>("UpdateOnlineUsers", (message) =>
            {
                OnOnlineUsersUpdated?.Invoke(message.FromJson <List <User> >());
            });

            _hubConnection.On <int>("UpdateBalance", (balance) =>
            {
                OnBalanceUpdated?.Invoke(balance);
            });

            _hubConnection.On <string>("IncomingCall", (connectionId) =>
            {
                OnIncomingCall?.Invoke(connectionId);
            });

            _hubConnection.On <string>("CallAccepted", (connectionId) =>
            {
                OnCallAccepted?.Invoke(connectionId);
            });

            _hubConnection.On <string>("CallDeclined", (message) =>
            {
                OnCallDeclined?.Invoke(message.FromJson <UserActionMessage>());
            });

            _hubConnection.On <string>("CallEnded", (message) =>
            {
                OnCallEnded?.Invoke(message.FromJson <UserActionMessage>());
            });

            _hubConnection.On <string>("CallDenied", (message) =>
            {
                OnCallDenied?.Invoke(message.FromJson <ServerActionMessage>());
            });

            _hubConnection.On <string>("Poll", (message) =>
            {
                OnPoll?.Invoke(message.FromJson <PollMessage>());
            });

            _hubConnection.On <string, string>("ReceiveSignal", (connectionId, data) =>
            {
                OnSignalReceived?.Invoke(connectionId, data);
            });


            _hubConnection.On <string>("UpdateUsers", (message) =>
            {
                OnUsersUpdated?.Invoke(message.FromJson <List <User> >());
            });

            _hubConnection.On <string>("UpdateCalls", (message) =>
            {
                OnCallsUpdated?.Invoke(message.FromJson <List <UserCall> >());
            });

            _hubConnection.On <string>("CallAborted", (message) =>
            {
                OnCallAborted?.Invoke(message.FromJson <ServerActionMessage>());
            });
        }
Exemplo n.º 2
0
 private void ProcessUsersUpdated()
 {
     SaveUsers();
     OnUsersUpdated?.Invoke(_users);
 }
Exemplo n.º 3
0
 private void ProcessUsersUpdated()
 {
     OnUsersUpdated?.Invoke(_users);
 }