JLChen
2020-12-23 320d7cc8feb394d0ce3db2ec1d01593b554d990f
HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/RoomEditFunctionPageBLL.cs
@@ -53,24 +53,24 @@
        {
            functionRow.MouseUpEventHandler = (sender, e) => {
                btn.IsSelected = !btn.IsSelected;
                if (btn.IsSelected)
                if (changeList.Contains(function))
                {
                    function.roomIdList.Add(room.sid);
                }
                else
                    changeList.Remove(function);
                }else
                {
                    function.roomIdList.Remove(room.sid);
                    changeList.Add(function);
                }
            };
            btn.MouseUpEventHandler = (sender, e) => {
                btn.IsSelected = !btn.IsSelected;
                if (btn.IsSelected)
                if (changeList.Contains(function))
                {
                    function.roomIdList.Add(room.sid);
                    changeList.Remove(function);
                }
                else
                {
                    function.roomIdList.Remove(room.sid);
                    changeList.Add(function);
                }
            };
        }
@@ -104,7 +104,7 @@
                }
                btn.IsSelected = true;
                showedFunctionRoomId = btn.Tag.ToString() == "0" ? null : btn.Tag.ToString();
                LoadFunctionListRow(allocatedList.FindAll((obj) => obj.roomIdList.Contains(showedFunctionRoomId)));
                LoadFunctionListRow(allocatedList.FindAll((obj) => obj.roomIds.Contains(showedFunctionRoomId)));
                btnChoosedRoom.Text = chooseRoomName;
                dialog.Close();
            };
@@ -116,9 +116,28 @@
        void LoadEvent_SaveRoomData()
        {
            btnConfrim.MouseUpEventHandler = (sender, e) => {
                room.SaveRoomData();
                room.GetRoomFunctions(true);
                bodyView.RemoveFromParent();
                if (string.IsNullOrEmpty(room.roomId))//新增的房间,云端未创建roomid 无法保存数据
                {
                    newRoomAddFunction(changeList);
                    bodyView.RemoveFromParent();
                }
                else
                {
                    foreach (var f in changeList)
                    {
                        if(f.roomIds.Contains(room.roomId))
                        {
                            f.roomIds.Remove(room.roomId);
                        }
                        else
                        {
                            f.roomIds.Add(room.roomId);
                        }
                        f.SaveFunctionData(true);
                    }
                    room.GetRoomFunctions(true);
                    bodyView.RemoveFromParent();
                }
            };
        }