using System; using HDL_ON.Entity; using HDL_ON.UI.CSS; using Shared; namespace HDL_ON.UI { public partial class RoomEditFunctionPage { /// /// 加载事件列表 /// void LoadEventList() { LoadEvent_SaveRoomData(); LoadEvent_ChangeShowedFunctionListType(); LoadEvent_ShowChangeRoomDialog(); } /// /// 修改显示的功能列表 /// void LoadEvent_ChangeShowedFunctionListType() { btnUnallocated.MouseUpEventHandler = (sender, e) => { btnUnallocated.IsSelected = true; btnUnallocated.IsBold = true; btnAllocated.IsSelected = false; btnAllocated.IsBold = false; btnUnallocated.TextSize = CSS_FontSize.HeadlineFontSize; btnAllocated.TextSize = CSS_FontSize.TextFontSize; btnChoosedRoom.Visible = false; btnChooseRoomIcon.Visible = false; LoadFunctionListRow(unallocatedList); }; btnAllocated.MouseUpEventHandler = (sender, e) => { btnUnallocated.IsSelected = false; btnUnallocated.IsBold = false; btnAllocated.IsSelected = true; btnAllocated.IsBold = true; btnAllocated.TextSize = CSS_FontSize.HeadlineFontSize; btnUnallocated.TextSize = CSS_FontSize.TextFontSize; btnChoosedRoom.Visible = true; btnChooseRoomIcon.Visible = true; LoadFunctionListRow(allocatedList); }; } /// /// 修改房间功能列表 /// void LoadEvent_ChangeRoomFunctionList(FrameLayout functionRow, Button btn, Function function) { functionRow.MouseUpEventHandler = (sender, e) => { btn.IsSelected = !btn.IsSelected; if (btn.IsSelected) { function.roomIdList.Add(room.sid); } else { function.roomIdList.Remove(room.sid); } if (changeList.Contains(function)) { changeList.Remove(function); }else { changeList.Add(function); } }; btn.MouseUpEventHandler = (sender, e) => { btn.IsSelected = !btn.IsSelected; if (btn.IsSelected) { function.roomIdList.Add(room.sid); } else { function.roomIdList.Remove(room.sid); } if (changeList.Contains(function)) { changeList.Remove(function); } else { changeList.Add(function); } }; } /// /// 显示选择房间弹窗 /// void LoadEvent_ShowChangeRoomDialog() { btnChoosedRoom.MouseUpEventHandler = (sender, e) => { LoadPage_LoadChooseRoomDialog(); }; btnChooseRoomIcon.MouseUpEventHandler = (sender, e) => { LoadPage_LoadChooseRoomDialog(); }; } Button lastButton; /// /// 根据选中的房间改变显示的功能列表 /// /// void LoadEvent_ChangeShowedFunctionList(Button btn,Dialog dialog,string chooseRoomName) { btn.MouseUpEventHandler = (sender, e) => { if (lastButton != null) { lastButton.IsSelected = false; } btn.IsSelected = true; showedFunctionRoomId = btn.Tag.ToString() == "0" ? null : btn.Tag.ToString(); LoadFunctionListRow(allocatedList.FindAll((obj) => obj.roomIdList.Contains(showedFunctionRoomId))); btnChoosedRoom.Text = chooseRoomName; dialog.Close(); }; } /// /// 保存房间修改的数据 /// void LoadEvent_SaveRoomData() { btnConfrim.MouseUpEventHandler = (sender, e) => { foreach(var f in changeList) { f.SaveFunctionData(); } room.SaveRoomData(); room.GetRoomFunctions(true); bodyView.RemoveFromParent(); }; } } }