public List<ChatMessage> Getnewmessage(User user) { List<ChatMessage> mynewmessage = incoming[user.Name]; incoming[user.Name]=new List<ChatMessage>(); if(mynewmessage.Count>0) return mynewmessage; else return null; }
/// <summary> /// /// </summary> /// <param name="user"></param> /// <returns></returns> public User Addnewuser(User user) { var exist = from User a in this.connecteduser where a.Name == user.Name select a; if (exist.Count() == 0) { this.connecteduser.Add(user); incoming.Add(user.Name, new List<ChatMessage>() { new ChatMessage(){User=user,Date=DateTime.Now,Message="welcome to chat"} }); Console.WriteLine("\n " + user.Name + "connect"); return user; } else return null; }
public void Removeuser(User user) { mainluncher.Removeuser(user); }
public List<ChatMessage> Getnewmessage(User user) { return mainluncher.Getnewmessage(user); }
public void Removeuser(User user) { this.connecteduser.RemoveAll(a => a.Name ==user.Name); /// }