| | |
| | | /// <summary> |
| | | /// 标题栏修改楼层之后的回调事件 |
| | | /// </summary> |
| | | Action<string,string> topCallBack; |
| | | Action<string,string> refreshFloorList; |
| | | /// <summary> |
| | | /// 后退回调事件 |
| | | /// </summary> |
| | |
| | | bodyView = this; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 从房间进入楼层修改界面,需要回调事件更新房间的楼层信息 |
| | | /// </summary> |
| | | /// <param name="action"></param> |
| | | public FloorsManagementPage(Action action) |
| | | { |
| | | bodyView = this; |
| | |
| | | { |
| | | 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; |
| | |
| | | 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() |
| | | { |
| | |
| | | /// <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); |
| | | |
| | |
| | | |
| | | 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); |
| | |
| | | } |
| | | } |
| | | |
| | | 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) |
| | |
| | | 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> |