Ejemplo n.º 1
0
        private void HandleUpdatedDataBaseClients(object sender, MessageContainer msgContainer)
        {
            switch (msgContainer.Identifier)
            {
            case MsgType.UpdatedDataBaseClients:
                if (((JObject)msgContainer.Payload).ToObject(typeof(UpdatedDataBaseClients)) is UpdatedDataBaseClients messageRequest)
                {
                    ApplicationDispatcherHelper.BeginInvoke(() => UpdatedDataBaseClientsEvent?.Invoke(messageRequest.ClientsList));
                }

                break;

            case MsgType.UpdatedDataBaseMessages:
                if (((JObject)msgContainer.Payload).ToObject(typeof(UpdatedDataBaseMessages)) is UpdatedDataBaseMessages messageRequest1)
                {
                    var personalMessagesList = new List <DataBaseMessage>();
                    foreach (DataBaseMessage message in messageRequest1.MessagesList)
                    {
                        if (message.ClientFrom == Login || message.ClientTo == Login || message.ClientTo == "CommonChat")
                        {
                            personalMessagesList.Add(message);
                        }
                    }

                    ApplicationDispatcherHelper.BeginInvoke(() => UpdatedDataBaseMessagesEvent?.Invoke(personalMessagesList));
                }

                break;

            case MsgType.UpdatedDataBaseEvents:
                if (((JObject)msgContainer.Payload).ToObject(typeof(UpdatedDataBaseEvents)) is UpdatedDataBaseEvents messageRequest2)
                {
                    ApplicationDispatcherHelper.BeginInvoke(() => UpdatedDataBaseEventsEvent?.Invoke(messageRequest2.EventsList));
                }

                break;
            }
        }
Ejemplo n.º 2
0
 public void HandleUpdatedUsersList(List <string> activeUsersList, List <string> notActiveUsersList)
 {
     ApplicationDispatcherHelper.BeginInvoke(() => UpdatedUsersListEvent?.Invoke(activeUsersList, notActiveUsersList));
 }
Ejemplo n.º 3
0
 private void HandleOkReceived(object sender, OkReceiveMsg okReceive)
 {
     ApplicationDispatcherHelper.Invoke(() => OkReceivedEvent?.Invoke(okReceive));
 }
Ejemplo n.º 4
0
 private void HandleMessageReceived(object sender, MessageReceivedEventArgs state)
 {
     ApplicationDispatcherHelper.BeginInvoke(() => MessageReceivedEvent?.Invoke(state));
 }