private void ConnectionLostHandler() { MessageBox.Show("与服务端的连接丢失"); ChatUserInfos.Clear(); ChatRecords.Clear(); NetworkClient.Stop(); GlobalValue.IsInRoom = false; MainWindow.VM.Status = "Not in room...."; }
private void RoomCloseHandler() { MessageBox.Show("当前房间已关闭"); ChatUserInfos.Clear(); ChatRecords.Clear(); NetworkClient.Stop(); if (GlobalValue.IsRoomMaster) { GlobalValue.IsRoomMaster = false; BroadcastServer.Stop(); NetworkServer.Stop(); } GlobalValue.IsInRoom = false; MainWindow.VM.Status = "Not in room...."; }
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); } }