| | |
| | | using System; |
| | | using Shared; |
| | | using HDL_ON.Entity; |
| | | |
| | | namespace HDL_ON.UI |
| | | { |
| | |
| | | LoadEvent_PictureOptionView(); |
| | | LoadEvent_EditRoomName(); |
| | | LoadEvent_SkinBindFloor(); |
| | | LoadEvent_SkipEditFunctionList(); |
| | | LoadEvent_Option(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 底部按钮事件 |
| | | /// </summary> |
| | | void LoadEvent_Option() |
| | | { |
| | | btnOption.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | if (btnOption.TextID == StringId.Save) |
| | | { |
| | | foreach (var tempRoom in DB_ResidenceData.residenceData.rooms) |
| | | { |
| | | if (room.name == tempRoom.name) |
| | | { |
| | | new PublicAssmebly().TipMsg(StringId.Tip, StringId.AddingFailed_RoomAlreadyExists); |
| | | return; |
| | | } |
| | | } |
| | | room.sid = Guid.NewGuid().ToString(); |
| | | DB_ResidenceData.residenceData.rooms.Add(room); |
| | | DB_ResidenceData.residenceData.SaveResidenceData(); |
| | | backAction(); |
| | | this.RemoveFromParent(); |
| | | } |
| | | if (btnOption.TextID == StringId.DeleteRoom) |
| | | { |
| | | Action action = () => |
| | | { |
| | | foreach (var f in DB_ResidenceData.residenceData.functionList.functions) |
| | | { |
| | | if (f.roomIdList.Contains(room.sid)) |
| | | { |
| | | f.roomIdList.Remove(room.sid); |
| | | room.sid = ""; |
| | | } |
| | | } |
| | | DB_ResidenceData.residenceData.rooms.Remove(room); |
| | | backAction(); |
| | | this.RemoveFromParent(); |
| | | }; |
| | | new PublicAssmebly().TipMsg(StringId.Tip, StringId.DeleteRoomTip, action); |
| | | }; |
| | | }; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | { |
| | | btnRoomName.Text = btnTipRoomName.Text = str; |
| | | room.name = str; |
| | | if (pageTitleId == StringId.EditRoomInfo) |
| | | { |
| | | DB_ResidenceData.residenceData.SaveResidenceData(); |
| | | } |
| | | }; |
| | | EventHandler<MouseEventArgs> eventHandler = (sender, e) => |
| | | { |
| | |
| | | }; |
| | | btnEditRoomNameIcon.MouseUpEventHandler = eventHandler; |
| | | roomNameRow.MouseUpEventHandler = eventHandler; |
| | | btnRoomName.MouseUpEventHandler = eventHandler; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | void LoadEvent_SkinBindFloor() |
| | | { |
| | | EventHandler<MouseEventArgs> eventHandler = (sender, e) => { |
| | | var residentialManagePage = new FloorsManagementPage(); |
| | | EventHandler<MouseEventArgs> eventHandler = (sender, e) => |
| | | { |
| | | Action floorsCallBackAction = () => |
| | | { |
| | | btnFloorInfo.Text = room.floor; |
| | | }; |
| | | var residentialManagePage = new FloorsManagementPage(floorsCallBackAction); |
| | | MainPage.BasePageView.AddChidren(residentialManagePage); |
| | | residentialManagePage.LoadPage(room); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | btnFloorInfo.MouseUpEventHandler = eventHandler; |
| | | floorView.MouseUpEventHandler = eventHandler; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 跳转到编辑房间功能界面 |
| | | /// </summary> |
| | | void LoadEvent_SkipEditFunctionList() |
| | | { |
| | | EventHandler<MouseEventArgs> eventHandler = (sender, e) => { |
| | | var residentialManagePage = new RoomEditFunctionPage(room.sid); |
| | | MainPage.BasePageView.AddChidren(residentialManagePage); |
| | | residentialManagePage.LoadPage(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | btnFunctionManagementRight.MouseUpEventHandler = eventHandler; |
| | | functionManagemantView.MouseUpEventHandler = eventHandler; |
| | | } |
| | | |
| | | |
| | |
| | | }; |
| | | |
| | | btnCancel.MouseUpEventHandler = (sender, e) => { |
| | | optionView.Animate = Animate.UpToDown; |
| | | btnCancel.Animate = Animate.UpToDown; |
| | | new System.Threading.Thread(() => |
| | | { |
| | | System.Threading.Thread.Sleep(500); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | //optionView.Animate = Animate.UpToDown; |
| | | //btnCancel.Animate = Animate.UpToDown; |
| | | //new System.Threading.Thread(() => |
| | | //{ |
| | | //System.Threading.Thread.Sleep(500); |
| | | //Application.RunOnMainThread(() => |
| | | //{ |
| | | pictureOptionView.RemoveFromParent(); |
| | | }); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | //}); |
| | | //}) |
| | | //{ IsBackground = true }.Start(); |
| | | }; |
| | | |
| | | btnTakePicture.MouseUpEventHandler = (sender, e) => { |
| | |
| | | return; |
| | | btnRoomBg.UnSelectedImagePath = pid.ToString(); |
| | | },pid.ToString(),false); |
| | | if(pageTitleId == StringId.EditRoomInfo) |
| | | { |
| | | DB_ResidenceData.residenceData.SaveResidenceData(); |
| | | } |
| | | }; |
| | | |
| | | btnAlbum.MouseUpEventHandler = (sender, e) => { |
| | |
| | | return; |
| | | btnRoomBg.UnSelectedImagePath = pid.ToString(); |
| | | }, pid.ToString(), false); |
| | | if (pageTitleId == StringId.EditRoomInfo) |
| | | { |
| | | DB_ResidenceData.residenceData.SaveResidenceData(); |
| | | } |
| | | }; |
| | | |
| | | |