public void RegisterClient(string nickname, string urlClient) { // obtain client remote object RemoteChatRoomIClient remoteClient = (RemoteChatRoomIClient)Activator.GetObject(typeof(RemoteChatRoomIClient), urlClient); _clients.Add(new ChatClient(remoteClient, nickname)); Console.WriteLine("New user " + nickname + " with url " + urlClient + " registered in room "); }
// function to be used by delegate to be called asynchronously with BeginInvoke public void UpdateMessages(RemoteChatRoomIClient remoteClient, string nickname, string message) { if (remoteClient == null) { Console.WriteLine("Could not obtain remote client " + nickname); } else { remoteClient.UpdateMessages(nickname, message); } }
public ChatClient(RemoteChatRoomIClient remoteClient, string nickname) { _remoteClient = remoteClient; _nickname = nickname; }