internal static void Main() { var chatRoom = new ChatRoom(); Participant george = new Beetle("George"); Participant paul = new Beetle("Paul"); Participant ringo = new Beetle("Ringo"); Participant john = new Beetle("John"); Participant yoko = new NonBeetle("Yoko"); chatRoom.Register(george); chatRoom.Register(paul); chatRoom.Register(ringo); chatRoom.Register(john); chatRoom.Register(yoko); yoko.Send("John", "Hi John!"); paul.Send("Ringo", "All you need is love"); ringo.Send("George", "My sweet Lord"); paul.Send("John", "Can't buy me love"); john.Send("Yoko", "My sweet love"); // Wait for user Console.ReadKey(); }
public ChatRoomManager(string name, ChatRoom chatRoom) : base(name, chatRoom) { }
public void Message(string msg) { ChatRoom.SendMessage(this, msg); }
public void Leave() { chatRoom?.Leave(this); chatRoom = null; }
public void Join(ChatRoom chatRoom) { this.chatRoom = chatRoom; chatRoom.Join(this); }
public User(string name, ChatRoom chatRoom = null) { Name = name; this.chatRoom = chatRoom; chatRoom?.Join(this); }
public User(ChatRoom room, String id, String name) { this.mediator = room; this.name = name; this.id = id; }
public void sendMessage(string message) { ChatRoom.showMessage(this, message); }
public void SendMessage(String message) { ChatRoom.ShowMessage(this, message); }
public void SendMessage(string message) { ChatRoom.SendMessage(this, message); }