| | |
| | | /// <summary> |
| | | /// 楼层按钮修改名称点击事件 |
| | | /// </summary> |
| | | void LoadEvent_FloorNamgeChange(Button btn,Button btnDel,RowLayout row,Floor floor) |
| | | void LoadEvent_FloorNamgeChange(Button btn,SpatialInfo floor) |
| | | { |
| | | btn.MouseUpEventHandler = (sender, e) => |
| | | { |
| | |
| | | }.Show(bodyView); |
| | | return; |
| | | } |
| | | if (Floor.InsFloor.Floors.Find((obj) => obj.roomName == newName) != null) |
| | | if (SpatialInfo.CurrentSpatial.FloorList.Find((obj) => obj.roomName == newName) != null) |
| | | { |
| | | return; |
| | | } |
| | | else |
| | | { |
| | | floor.roomName = newName; |
| | | floor.SaveFloorData(); |
| | | btn.Text = newName; |
| | | btnDel.Tag = newName; |
| | | row.Tag = newName; |
| | | var waitPage = new Loading(); |
| | | MainPage.BaseView.AddChidren(waitPage); |
| | | waitPage.Start(Language.StringByID(StringId.PleaseWait)); |
| | | new System.Threading.Thread(() => |
| | | { |
| | | try |
| | | { |
| | | var editResult = SpatialInfo.CurrentSpatial.UpdateFloor(floor); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | if (editResult == DAL.Server.StateCode.SUCCESS) |
| | | { |
| | | floor.roomName = newName; |
| | | btn.Text = newName; |
| | | } |
| | | }); |
| | | } |
| | | catch { } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => { |
| | | waitPage.Hide(); |
| | | waitPage.RemoveFromParent(); |
| | | }); |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | }; |
| | | var floors = new List<string>(); |
| | | foreach (var f in Floor.InsFloor.Floors) |
| | | foreach (var f in SpatialInfo.CurrentSpatial.FloorList) |
| | | { |
| | | floors.Add(f.roomName); |
| | | } |
| | | new PublicAssmebly().LoadDialog_EditParater(StringId.EditFloorName, btn.Text, editCallBack,StringId.FloorNameCannotBeEmpty, |
| | | StringId.EditFloorFailed_FloorAlreadyExist,floors); |
| | | }; |
| | | } |
| | | |
| | | |
| | | /// <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; |
| | | }; |
| | | } |
| | | |
| | |
| | | { |
| | | Action action = () => |
| | | { |
| | | refreshFloorList("del", btn.Tag.ToString()); |
| | | //该楼层删除之后,绑定该楼层的房间要重置绑定的楼层 |
| | | foreach (var r in SpatialInfo.CurrentSpatial.RoomList) |
| | | { |
| | | if (r.parentId == btn.Tag.ToString()) |
| | | { |
| | | r.parentId = ""; |
| | | } |
| | | } |
| | | SpatialInfo.CurrentSpatial.DelFloor(btn.Tag.ToString()); |
| | | 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(); |
| | | int count = SpatialInfo.CurrentSpatial.FloorList.Count > 8 ? 8 : SpatialInfo.CurrentSpatial.FloorList.Count; |
| | | var contentViewHeight = (count + 1) * Application.GetRealHeight(50); |
| | | contentView.Height = contentViewHeight; |
| | | floorsListView.Height = count * Application.GetRealHeight(50); |
| | | } |
| | | } |
| | | } |
| | | }; |
| | | new PublicAssmebly().TipMsg(StringId.Tip, StringId.DelFloorTip, action); |
| | | new PublicAssmebly().TipOptionMsg(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(); |
| | | }; |
| | | } |
| | | |
| | | } |
| | | } |