예제 #1
0
        public void Logout(string userName)
        {
            CheckinUser logoutUser = CheckinCC.GetUser(userName);

            CheckinCC.Users.Remove(logoutUser);
            foreach (var user in CheckinCC.Users)
            {
                user.Checkincallback.ShowLogout(userName);
            }
            logoutUser = null; //将其设置为null后,WCF会自动关闭该客户端
        }
예제 #2
0
        public void Login(string userName)
        {
            OperationContext       context  = OperationContext.Current;
            ICheckinServerCallback callback = context.GetCallbackChannel <ICheckinServerCallback>();
            CheckinUser            newUser  = new CheckinUser(userName, callback);

            CheckinCC.Users.Add(newUser);
            foreach (var user in CheckinCC.Users)
            {
                user.Checkincallback.ShowLogin(userName);
            }
        }
예제 #3
0
        public static CheckinUser GetUser(string username)
        {
            CheckinUser user = null;

            foreach (var item in Users)
            {
                if (item.Name == username)
                {
                    user = item;
                    break;
                }
            }
            return(user);
        }