コード例 #1
0
        private void ReadMessageHandler(Messages message)
        {
            Action action = delegate
            {
                if (message is IndividualChatMessages)
                {
                    IndividualChatMessages individualChatMessage = (IndividualChatMessages)message;
                    if (client.id == individualChatMessage.ReceiverId)
                    {
                        participantsListBox.Items[individualChatMessage.SenderId] = client.participants[individualChatMessage.SenderId].Name;
                    }
                }
                else if (message is CommonChatMessages)
                {
                    participantsListBox.Items[CommonChatId] = CommonChatName;
                }
            };

            if (InvokeRequired)
            {
                Invoke(action);
            }
            else
            {
                action();
            }
        }
コード例 #2
0
        private void UnreadMessageHandler(string unreadMessageString, Messages message)
        {
            Action action = delegate
            {
                if (message is IndividualChatMessages)
                {
                    IndividualChatMessages individualChatMessage = (IndividualChatMessages)message;
                    if ((client.id == individualChatMessage.ReceiverId) && (selectedDialog != individualChatMessage.SenderId))
                    {
                        participantsListBox.Items[individualChatMessage.SenderId] = unreadMessageString;
                    }
                }
                else if ((message is CommonChatMessages) && (selectedDialog != CommonChatId))
                {
                    participantsListBox.Items[CommonChatId] = unreadMessageString;
                }
            };

            if (InvokeRequired)
            {
                Invoke(action);
            }
            else
            {
                action();
            }
        }
コード例 #3
0
 public void ShowReceivedMessage(Messages message)
 {
     if (message is RoomParticipantsMessage)
     {
         HandleRoomParticipantsMessage((RoomParticipantsMessage)message);
     }
     if (message is CreateRoomResponseMessage)
     {
         AddRoomToRoomsListBox((CreateRoomResponseMessage)message);
     }
     if (message is ServerUdpAnswerMessages)
     {
         AddServerInfoToServersListBox((ServerUdpAnswerMessages)message);
     }
     else if (message is ParticipantsListMessages)
     {
         RefreshParticipantsListBox((ParticipantsListMessages)message);
     }
     else if (message is RoomMessage)
     {
         HandleRoomMessage((RoomMessage)message);
     }
     else if (message is CommonChatMessages)
     {
         CommonChatMessages commonChatMessage = (CommonChatMessages)message;
         HandleChatMessage(commonChatMessage);
     }
 }