public void AskToChat(AskToChatTypes eventData, string userToChat) { lock (locker) { var inactiveClients = new List <string>(); foreach (var client in ChatClients) { //if (client.Key != eventData.ClientName) //{ if (userToChat == client.Key) { try { client.Value.BroadcastToChatClient(eventData); } catch (Exception ex) { inactiveClients.Add(client.Key); } } //} } if (inactiveClients.Count > 0) { foreach (var client in inactiveClients) { clients.Remove(client); } } } }
public void HandleBroadcastAskToChat(object sender, EventArgs e) { AskToChatTypes _event = (AskToChatTypes)sender; //MessageBox.Show(_event.UserAsking + " wants to chat with you"); ChatWindow chatWindow1 = new ChatWindow(_event.UserAsking); ChatWindow chatWindow2 = new ChatWindow(_event.UserToAsk); chatWindow1.Show(); this.Close(); chatWindow2.Show(); this.Close(); }
public void BroadcastToChatClient(AskToChatTypes eventChat) { LogicInstance.ChatUserList(eventChat.UserAsking, eventChat.UserToAsk); OnBroadcastToChat(eventChat); }