private void UserExitHandler(byte[] data)
        {
            UserExit userExit = NetworkUtils.Deserialize <UserExit>(data);

            Application.Current.Dispatcher.BeginInvoke(new Action(() => {
                UserExitEvent?.Invoke(userExit);
            }));
        }
예제 #2
0
        private void UserExitHandler(Socket socket, byte[] data)
        {
            UserExit userExit = NetworkUtils.Deserialize <UserExit>(data);

            chatRoom.UserExit(new ChatUser()
            {
                socket   = socket,
                userName = userExit.UserName
            });
        }
예제 #3
0
        private void UserExitHandler(UserExit userExit)
        {
            if (isSelfExitRoom)
            {
                isSelfExitRoom = false;
                MessageBox.Show("你已经离开了房间");
                ChatUserInfos.Clear();
                ChatRecords.Clear();
                NetworkClient.Stop();
                GlobalValue.IsInRoom = false;
                MainWindow.VM.Status = "Not in room....";
                return;
            }

            ChatUserInfo chatUserInfo = ChatUserInfos.FirstOrDefault(c => c.UserName.Equals(userExit.UserName));

            if (chatUserInfo != null)
            {
                ChatUserInfos.Remove(chatUserInfo);
            }
        }
예제 #4
0
 public UserGroup()
 {
     memberList              = new NCList <T>();
     memberList.ItemAdded   += a => { UserJoin?.Invoke(a); };
     memberList.ItemRemoved += a => { UserExit?.Invoke(a); };
 }