| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using HDL_ON.Entity; |
| | | using HDL_ON.UI.CSS; |
| | | using Shared; |
| | |
| | | /// </summary> |
| | | static FrameLayout bodyView; |
| | | /// <summary> |
| | | /// 楼层选择下拉图标 |
| | | /// </summary> |
| | | Button btnFloorDownIcon; |
| | | /// <summary> |
| | | /// 楼层显示 |
| | | /// </summary> |
| | | Button btnFloor; |
| | | /// <summary> |
| | | /// 功能列表集合显示区域 |
| | | /// </summary> |
| | | static VerticalScrolViewLayout functionListView; |
| | | #endregion |
| | | |
| | | List<Function> functionList; |
| | | |
| | | public FunctionPage() |
| | | { |
| | | bodyView = this; |
| | | functionList = new List<Function>(); |
| | | } |
| | | |
| | | public void LoadPage(int titleId) |
| | |
| | | }; |
| | | bodyView.AddChidren(roomFloorChangeView); |
| | | #region 房间顶部切换显示区域 |
| | | /// <summary> |
| | | /// 楼层选择下拉图标 |
| | | /// </summary> |
| | | var btnFoorDownIcon = new Button() |
| | | btnFloorDownIcon = new Button() |
| | | { |
| | | Width = Application.GetMinRealAverage(16), |
| | | Height = Application.GetMinRealAverage(16), |
| | |
| | | Y = Application.GetRealHeight(18), |
| | | UnSelectedImagePath = "Public/DownIcon.png", |
| | | }; |
| | | roomFloorChangeView.AddChidren(btnFoorDownIcon); |
| | | /// <summary> |
| | | /// 楼层显示 |
| | | /// </summary> |
| | | var btnFoor = new Button() |
| | | roomFloorChangeView.AddChidren(btnFloorDownIcon); |
| | | |
| | | btnFloor = new Button() |
| | | { |
| | | X = btnFoorDownIcon.Right, |
| | | X = btnFloorDownIcon.Right, |
| | | Y = Application.GetRealHeight(18), |
| | | Width = Application.GetRealWidth(200), |
| | | Height = Application.GetMinRealAverage(16), |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | Text = UserConfig.Instance.CurFoor, |
| | | Text = DB_ResidenceData.Instance.CurFloor.roomName, |
| | | }; |
| | | roomFloorChangeView.AddChidren(btnFoor); |
| | | roomFloorChangeView.AddChidren(btnFloor); |
| | | #endregion |
| | | |
| | | functionListView = new VerticalScrolViewLayout() |
| | |
| | | }; |
| | | bodyView.AddChidren(functionListView); |
| | | |
| | | foreach (var function in DB_ResidenceData.residenceData.functionList.functions) |
| | | if (titleId == StringId.Lights) |
| | | { |
| | | if (titleId == StringId.Lights) |
| | | { |
| | | if (function.functionCategory != FunctionCategory.Light) |
| | | { |
| | | continue; |
| | | } |
| | | } |
| | | if (titleId == StringId.AC) |
| | | { |
| | | if (function.functionCategory != FunctionCategory.AC) |
| | | { |
| | | continue; |
| | | } |
| | | } |
| | | if (titleId == StringId.Curtain) |
| | | { |
| | | if (function.functionCategory != FunctionCategory.Curtain) |
| | | { |
| | | continue; |
| | | } |
| | | } |
| | | functionListView.AddChidren(new Button() { Height = Application.GetRealHeight(12) }); |
| | | functionList.AddRange(FunctionList.List.GetLightList()); |
| | | } |
| | | else if (titleId == StringId.AC) |
| | | { |
| | | functionList.AddRange(FunctionList.List.GetAcList()); |
| | | } |
| | | else if (titleId == StringId.Curtain) |
| | | { |
| | | functionList.AddRange(FunctionList.List.GetCurtainList()); |
| | | } |
| | | else if (titleId == StringId.FloorHeating) |
| | | { |
| | | functionList.AddRange(FunctionList.List.GetFloorHeatingList()); |
| | | } |
| | | else if (titleId == StringId.Electric) |
| | | { |
| | | functionList.AddRange(FunctionList.List.GetElectricals()); |
| | | } |
| | | else if (titleId == StringId.EnvironmentalScience) |
| | | { |
| | | functionList.AddRange(FunctionList.List.GetEnvirSensorsList()); |
| | | } |
| | | else if (titleId == StringId.Sensor) |
| | | { |
| | | functionList.AddRange(FunctionList.List.GetArmSensorList()); |
| | | }
|
| | | else if (titleId == StringId.FreshAir) |
| | | { |
| | | functionList.AddRange(FunctionList.List.GetAirFreshList()); |
| | | } |
| | | functionList.OrderByDescending(o => o.controlCounter).ToList(); |
| | | |
| | | if (function.functionType == FunctionType.RGB || function.functionType == FunctionType.Dimmer) |
| | | ShowFunctionRow(functionList); |
| | | |
| | | LoadDialog_ChangeFloor(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 加载功能row |
| | | /// </summary> |
| | | void ShowFunctionRow(List<Function> showList) |
| | | { |
| | | functionListView.RemoveAll(); |
| | | foreach (var function in showList) |
| | | { |
| | | |
| | | if (function.spk == SPK.LightRGB || function.spk == SPK.LightDimming) |
| | | { |
| | | var functionDiv = new FunctionControlZone(function) |
| | | { |
| | |
| | | BorderColor = 0x00FFFFFF, |
| | | BorderWidth = 1, |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | Tag = function.functionCategory.ToString() + "-" + function.functionType |
| | | Tag = function.spk + function.sid |
| | | }; |
| | | functionDiv.LoadFunctionDiv(); |
| | | functionListView.AddChidren(functionDiv); |
| | |
| | | BorderColor = 0x00FFFFFF, |
| | | BorderWidth = 1, |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | Tag = function.functionCategory.ToString() + "-" + function.functionType |
| | | Tag = function.spk + function.sid |
| | | }; |
| | | functionDiv.LoadFunctionDiv(); |
| | | functionListView.AddChidren(functionDiv); |
| | | } |
| | | functionListView.AddChidren(new Button() { Height = Application.GetRealHeight(10) }); |
| | | } |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 住宅列表点击事件 |
| | | /// </summary> |
| | | void LoadDialog_ChangeFloor() |
| | | { |
| | | string nowSelectId = null; |
| | | btnFloor.MouseUpEventHandler += (sender, e) =>
|
| | | {
|
| | | //显示下拉列表
|
| | | var form = new FloorRoomSelectPopupView();
|
| | | form.ShowDeviceFunctionView(btnFloor, this.functionList, (selectId, listFunc) =>
|
| | | {
|
| | | nowSelectId = selectId;
|
| | | //重新加载界面
|
| | | ShowFunctionRow(listFunc);
|
| | | }, nowSelectId);
|
| | | }; |
| | | } |
| | | } |
| | | } |