public void Login(UserInfo info) { if (FindClientByNick(info.Nick) != null) { throw new NicknameInUseException(String.Format("Nickname {0} already in use.")); } var client = CurrentClient; client.Disconnected += client_Disconnected; var proxy = client.GetClientProxy<IChatClient>(); var chatClient = new ChatClient(client, proxy, info); _clients[client.ClientId] = chatClient; Task.Factory.StartNew( () => { OnUserListChanged(); SendUserListToClient(chatClient); SendNewUserInfoToAllClients(info); } ); }
private void SendUserListToClient(ChatClient client) { //send the list of Users to a newly joined client, minus its own nick var userArray = UserList.Where((user) => user.Nick != client.User.Nick).ToArray(); if (userArray.Length <= 0) return; client.ClientProxy.GetUserList(userArray); }