wxr
2020-04-14 06696e6f225733a60b03eea4a7c6374053d92c1d
HDL_ON/UI/UI2/4-PersonalCenter/ResidentialManage/FloorsManagementPage.cs
@@ -34,7 +34,7 @@
        /// <summary>
        /// 标题栏修改楼层之后的回调事件
        /// </summary>
        Action<string,string> topCallBack;
        Action<string,string> refreshFloorList;
        /// <summary>
        /// 后退回调事件
        /// </summary>
@@ -45,6 +45,10 @@
            bodyView = this;
        }
        /// <summary>
        /// 从房间进入楼层修改界面,需要回调事件更新房间的楼层信息
        /// </summary>
        /// <param name="action"></param>
        public FloorsManagementPage(Action action)
        {
            bodyView = this;
@@ -57,10 +61,10 @@
        {
            bodyView.RemoveAll();
            bodyView.BackgroundColor = CSS_Color.BackgroundColor;
            topCallBack = (type,floor) => {
                ChangeFloorsListView(type, floor);
            refreshFloorList = (type,floor) => {
                RefreshFloorsListView(type, floor);
            };
            new TopViewDiv(bodyView, Language.StringByID(StringId.FloorsManagement)).LoadTopView("floors",topCallBack,backAction);
            new TopViewDiv(bodyView, Language.StringByID(StringId.FloorsManagement)).LoadTopView("floors",refreshFloorList,backAction);
            //new PublicAssmebly().LoadTopView(bodyView, Language.StringByID(StringId.FloorsManagement),"floors",topCallBcak);
            int count = DB_ResidenceData.residenceData.floors.Count > 8 ? 8 : DB_ResidenceData.residenceData.floors.Count;
@@ -89,6 +93,12 @@
                TextColor = CSS_Color.FirstLevelTitleColor,
            };
            contentView.AddChidren(btnFloorTitle);
            contentView.AddChidren(new Button()
            {
                Height = Application.GetRealHeight(1),
                Y = Application.GetRealHeight(49),
                BackgroundColor = CSS_Color.DividingLineColor,
            });
            floorsListView = new VerticalScrolViewLayout()
            {
@@ -109,18 +119,11 @@
        /// <param name="floor"></param>
        void LoadFloorRow(string floor)
        {
            floorsListView.AddChidren(
                  new Button()
                  {
                      Height = Application.GetRealHeight(1),
                      BackgroundColor = CSS_Color.DividingLineColor,
                      Tag = floor + "line"
                  });
            var row = new RowLayout()
            {
                Height = Application.GetRealHeight(50),
                Tag = floor
                Tag = floor,
                LineColor = CSS_Color.DividingLineColor,
            };
            floorsListView.AddChidren(row);
@@ -137,14 +140,14 @@
            if (room == null)
            {
                LoadEvent_FloorNamgeChange(floor, btnFloor);
                LoadEvent_FloorNamgeChange(btnFloor);
                var btnDel = new Button()
                {
                    TextID = StringId.Del,
                    BackgroundColor = CSS_Color.WarningColor,
                    TextColor = CSS_Color.MainBackgroundColor,
                    Tag = floor
                    Tag = DB_ResidenceData.residenceData.floors.IndexOf(floor)
                };
                row.AddRightView(btnDel);
                LoadEvent_DelFloor(btnDel);
@@ -154,16 +157,14 @@
            }
        }
        void ChangeFloorsListView(string changeType,string floorName)
        void RefreshFloorsListView(string changeType,string floorName)
        {
            int count = DB_ResidenceData.residenceData.floors.Count > 10 ? 10 : DB_ResidenceData.residenceData.floors.Count;
            floorsListView.Height = Application.GetRealHeight(50 * count);
            contentView.Height = Application.GetRealHeight(50 * (count + 1));
            switch (changeType)
            {
                case "add":
                    try
                    {
                        DB_ResidenceData.residenceData.floors.Add(floorName);
                        LoadFloorRow(floorName);
                    }
                    catch (Exception ex)
@@ -215,14 +216,19 @@
                            RowLayout row = floorsListView.GetChildren(i) as RowLayout;
                            if (row.Tag == null)
                                continue;
                            if (row.Tag.ToString() == floorName )
                            if (row.Tag.ToString() == floorName)
                            {
                                row.RemoveFromParent();
                            }
                        }
                        DB_ResidenceData.residenceData.floors.Remove(floorName);
                    }
                    break;
            }
            DB_ResidenceData.residenceData.SaveResidenceData();
            int count = DB_ResidenceData.residenceData.floors.Count > 10 ? 10 : DB_ResidenceData.residenceData.floors.Count;
            floorsListView.Height = Application.GetRealHeight(50 * count);
            contentView.Height = Application.GetRealHeight(50 * (count + 1));
        }
        /// <summary>