private void SendUsersOnlineListToUser(IBroadcasterClient chatClient) { foreach (var client in _clientsOnline) { chatClient.OnUserCame(client.GetUsername()); } }
private void SendHeundreedMessagesToUser(IBroadcasterClient chatClient) { foreach (var message in _hundreedMessages) { chatClient.OnMessageRecieved(message); } }
public void RemoveBroadcasterClient(IBroadcasterClient chatClient) { lock (this) { _clientsOnline.Remove(chatClient); chatClient.Dispose(); NotifyClientsUserQuit(chatClient.GetUsername()); } }
public void AddBroadcasterClient(IBroadcasterClient chatClient) { lock (this) { try { SendHeundreedMessagesToUser(chatClient); SendUsersOnlineListToUser(chatClient); } catch (Exception) { chatClient.Dispose(); } _clientsOnline.Add(chatClient); NotifyClientsNewUserCame(chatClient.GetUsername()); } }