using System; using HDL_ON.Entity; using HDL_ON.UI.CSS; using Shared; namespace HDL_ON.UI { /// /// 功能分配房间界面 /// public partial class ChooseRoomPage : FrameLayout { #region 控件列表 FrameLayout bodyView; /// /// 内容加载区域 /// VerticalScrolViewLayout contentView; Button btnChooseAll; #endregion #region 局部变量 Function function; /// /// 回调事件 /// Action backAction; #endregion public ChooseRoomPage(Function func,Action action) { bodyView = this; function = func; backAction = action; } /// /// 加载页面 /// public void LoadPage() { bodyView.BackgroundColor = CSS_Color.BackgroundColor; new TopViewDiv(bodyView, Language.StringByID(StringId.LocationManagement)).LoadTopView(backAction); contentView = new VerticalScrolViewLayout() { Y = Application.GetRealHeight(64), Height = Application.GetRealHeight(667 - 64), }; bodyView.AddChidren(contentView); var allRoomView = new FrameLayout() { Height = Application.GetRealHeight(50), BackgroundColor = CSS_Color.MainBackgroundColor, }; contentView.AddChidren(allRoomView); Button btnAllRoomText = new Button() { X = Application.GetRealWidth(16), Width = Application.GetRealWidth(280), TextID = StringId.All, TextSize= CSS_FontSize.SubheadingFontSize, TextColor = CSS_Color.FirstLevelTitleColor, TextAlignment = TextAlignment.CenterLeft, }; allRoomView.AddChidren(btnAllRoomText); btnChooseAll = new Button() { X = Application.GetRealWidth(331), Gravity = Gravity.CenterVertical, Width = Application.GetMinRealAverage(28), Height = Application.GetMinRealAverage(28), UnSelectedImagePath = "Public/ChooseIcon.png", SelectedImagePath = "Public/ChooseOnIcon.png", IsSelected = true }; allRoomView.AddChidren(btnChooseAll); foreach(var room in DB_ResidenceData.rooms) { var roomView = new FrameLayout() { Height = Application.GetRealHeight(50), BackgroundColor = CSS_Color.MainBackgroundColor, Tag = "row" }; contentView.AddChidren(roomView); var btnLine = new Button() { Gravity = Gravity.CenterHorizontal, Height = Application.GetMinReal(1), Width = Application.GetRealWidth(343), BackgroundColor = CSS_Color.DividingLineColor, }; roomView.AddChidren(btnLine); Button btnRoomText = new Button() { X = Application.GetRealWidth(16), Width = Application.GetRealWidth(280), TextSize = CSS_FontSize.SubheadingFontSize, TextColor = CSS_Color.FirstLevelTitleColor, TextAlignment = TextAlignment.CenterLeft, Text = room.floorName + room.name, }; roomView.AddChidren(btnRoomText); Button btnChoose = new Button() { X = Application.GetRealWidth(331), Gravity = Gravity.CenterVertical, Width = Application.GetMinRealAverage(28), Height = Application.GetMinRealAverage(28), UnSelectedImagePath = "Public/ChooseIcon.png", SelectedImagePath = "Public/ChooseOnIcon.png", IsSelected = function.roomIdList.Contains(room.sid), Tag = "ChooseIcon" }; roomView.AddChidren(btnChoose); btnChoose.MouseUpEventHandler = (sender, e) => { btnChoose.IsSelected = !btnChoose.IsSelected; LoadEvent_RoomSelected(room, btnChoose.IsSelected); }; if (!function.roomIdList.Contains(room.sid) && btnChooseAll.IsSelected) { btnChooseAll.IsSelected = false; } } LoadEventLoad(); } } }