예제 #1
0
 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;
 }
예제 #2
0
        /// <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;
        }
예제 #3
0
 public void Removeuser(User user)
 {
     mainluncher.Removeuser(user);
 }
예제 #4
0
 public List<ChatMessage> Getnewmessage(User user)
 {
     return mainluncher.Getnewmessage(user);
 }
예제 #5
0
 public void Removeuser(User user)
 {
     this.connecteduser.RemoveAll(a => a.Name ==user.Name);
     ///
 }