using System; using HDL_ON.Entity; using HDL_ON.UI.CSS; using Shared; namespace HDL_ON.UI { public partial class RoomPage : FrameLayout { #region 控件列表 /// /// 当前窗体 /// static FrameLayout bodyView; /// /// 功能列表集合显示区域 /// static VerticalScrolViewLayout functionListView; #endregion #region static Room room; #endregion public RoomPage(Room r) { bodyView = this; room = r; } public void LoadPage() { Action skipAction = () => { LoadEvent_SkipEditRoomPage(); }; bodyView.BackgroundColor = CSS_Color.BackgroundColor; new TopViewDiv(bodyView,room.name).LoadTopView(room ,skipAction); functionListView = new VerticalScrolViewLayout() { Y = Application.GetRealHeight(64), Height = Application.GetRealHeight(603-12), }; bodyView.AddChidren(functionListView); foreach (var function in room.GetRoomFunctions(false)) { if (function.functionCategory == FunctionCategory.Sensor) { continue; } functionListView.AddChidren(new Button() { Height = Application.GetRealHeight(12) }); if (function.functionType == FunctionType.RGB || function.functionType == FunctionType.Dimmer) { var functionDiv = new FunctionControlZone(function) { Gravity = Gravity.CenterHorizontal, Width = Application.GetRealWidth(343), Height = Application.GetRealHeight(116), Radius = (uint)Application.GetMinRealAverage(12), BorderColor = 0x00FFFFFF, BorderWidth = 1, BackgroundColor = CSS_Color.MainBackgroundColor, Tag = function.functionCategory.ToString() + "-" + function.functionType + "-" + function.sid }; functionDiv.LoadFunctionDiv(); functionListView.AddChidren(functionDiv); } else { var functionDiv = new FunctionControlZone(function) { Gravity = Gravity.CenterHorizontal, Width = Application.GetRealWidth(343), Height = Application.GetRealHeight(96), Radius = (uint)Application.GetMinRealAverage(12), BorderColor = 0x00FFFFFF, BorderWidth = 1, BackgroundColor = CSS_Color.MainBackgroundColor, Tag = function.functionCategory.ToString() + "-" + function.functionType + "-" + function.sid }; functionDiv.LoadFunctionDiv(); functionListView.AddChidren(functionDiv); } } } } }