private void UserExitHandler(byte[] data) { UserExit userExit = NetworkUtils.Deserialize <UserExit>(data); Application.Current.Dispatcher.BeginInvoke(new Action(() => { UserExitEvent?.Invoke(userExit); })); }
private void UserExitHandler(Socket socket, byte[] data) { UserExit userExit = NetworkUtils.Deserialize <UserExit>(data); chatRoom.UserExit(new ChatUser() { socket = socket, userName = userExit.UserName }); }
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); } }
public UserGroup() { memberList = new NCList <T>(); memberList.ItemAdded += a => { UserJoin?.Invoke(a); }; memberList.ItemRemoved += a => { UserExit?.Invoke(a); }; }