wei
2020-12-11 78df3d9006b4fa60c312cbda519096c167c1cf21
HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/FloorsManagementPageBLL.cs
@@ -10,7 +10,7 @@
        /// <summary>
        /// 楼层按钮修改名称点击事件
        /// </summary>
        void LoadEvent_FloorNamgeChange(Button btn,Button btnDel,RowLayout row,SpatialInfo floor)
        void LoadEvent_FloorNamgeChange(Button btn,SpatialInfo floor)
        {
            btn.MouseUpEventHandler = (sender, e) =>
            {
@@ -33,11 +33,12 @@
                    }
                    else
                    {
                        floor.roomName = newName;
                        floor.UpdateFloor();
                        btn.Text = newName;
                        btnDel.Tag = newName;
                        row.Tag = newName;
                        var editResult = SpatialInfo.CurrentSpatial.UpdateFloor(floor);
                        if (editResult == DAL.Server.StateCode.SUCCESS)
                        {
                            floor.roomName = newName;
                            btn.Text = newName;
                        }
                    }
                };
                var floors = new List<string>();
@@ -50,28 +51,6 @@
            };
        }
        /// <summary>
        /// 房间绑定楼层,楼层选中事件
        /// </summary>
        void LoadEvent_FloorChoose(Button btn)
        {
            btn.MouseUpEventHandler = (sender, e) => {
                if (lastButton != null)
                {
                    lastButton.IsSelected = false;
                    if (lastButton.Text == btn.Text)
                    {
                        lastButton = null;
                    }
                    //btn.IsBold = false;
                }
                btn.IsSelected = true;
                //btn.IsBold = true;
                lastButton = btn;
            };
        }
        /// <summary>
        /// 删除楼层
        /// </summary>
@@ -81,30 +60,31 @@
            {
                Action action = () =>
                {
                    refreshFloorList("del", btn.Tag.ToString());
                    //该楼层删除之后,绑定该楼层的房间要重置绑定的楼层
                    foreach (var r in DB_ResidenceData.residenceData.Rooms)
                    {
                        if (r.parentId == btn.Tag.ToString())
                        {
                            r.parentId = "";
                        }
                    }
                    for (int i = 0; i < floorsListView.ChildrenCount; i++)
                    {
                        if (floorsListView.GetChildren(i).GetType() == typeof(RowLayout))
                        {
                            RowLayout row = floorsListView.GetChildren(i) as RowLayout;
                            if (row.Tag == null)
                                continue;
                            if (row.Tag.ToString() == btn.Tag.ToString())
                            {
                                row.RemoveFromParent();
                            }
                        }
                        SpatialInfo.CurrentSpatial.DelFloor(btn.Tag.ToString());
                    }
                };
                new PublicAssmebly().TipMsg(StringId.Tip, StringId.DelFloorTip, action);
            };
        }
        /// <summary>
        /// 房间绑定楼层事件
        /// </summary>
        void LoadEvent_BindFloor()
        {
            btnConfrim.MouseUpEventHandler = (sender, e) =>
            {
                if (lastButton == null)
                {
                    return;
                }
                //room.parentId = lastButton.Tag.ToString();
                room.parentId = lastButton.Tag.ToString();
                backAction?.Invoke();
                bodyView.RemoveFromParent();
                //DB_ResidenceData.residenceData.SaveResidenceData();
            };
        }
    }
}