From a1b0ab7044100daaa7e0f1da2d2ca45e38098963 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期一, 29 三月 2021 09:13:25 +0800
Subject: [PATCH] 2021-3-29-2
---
HDL_ON/UI/UI2/2-Classification/FunctionPage.cs | 124 ++++++++++++++++++++++++++++-------------
1 files changed, 84 insertions(+), 40 deletions(-)
diff --git a/HDL_ON/UI/UI2/2-Classification/FunctionPage.cs b/HDL_ON/UI/UI2/2-Classification/FunctionPage.cs
index 54ba6df..1536bbb 100644
--- a/HDL_ON/UI/UI2/2-Classification/FunctionPage.cs
+++ b/HDL_ON/UI/UI2/2-Classification/FunctionPage.cs
@@ -1,5 +1,6 @@
锘縰sing System;
using System.Collections.Generic;
+using System.Linq;
using HDL_ON.Entity;
using HDL_ON.UI.CSS;
using Shared;
@@ -13,21 +14,31 @@
/// </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.BackgroundColor = CSS_Color.BackgroundColor;
new TopViewDiv(bodyView, Language.StringByID(titleId)).LoadTopView();
-
/// <summary>
/// 鎴块棿鍐呭鏄剧ず鍖哄煙
@@ -39,10 +50,7 @@
};
bodyView.AddChidren(roomFloorChangeView);
#region 鎴块棿椤堕儴鍒囨崲鏄剧ず鍖哄煙
- /// <summary>
- /// 妤煎眰閫夋嫨涓嬫媺鍥炬爣
- /// </summary>
- var btnFoorDownIcon = new Button()
+ btnFloorDownIcon = new Button()
{
Width = Application.GetMinRealAverage(16),
Height = Application.GetMinRealAverage(16),
@@ -50,24 +58,21 @@
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()
{
@@ -76,32 +81,51 @@
};
bodyView.AddChidren(functionListView);
- foreach (var function in DB_ResidenceData.residenceData.functionList.functions)
+ if (titleId == StringId.Lights)
{
- if (titleId == StringId.Lights)
- {
- if (function.functionCategory != FunctionType.Light)
- {
- continue;
- }
- }
- if (titleId == StringId.AC)
- {
- if (function.functionCategory != FunctionType.AC)
- {
- continue;
- }
- }
- if (titleId == StringId.Curtain)
- {
- if (function.functionCategory != FunctionType.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());
+ }
+ functionList.OrderByDescending(o => o.controlCounter).ToList();
- if (function.functionType == "RGB" || function.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)
{
@@ -112,7 +136,7 @@
BorderColor = 0x00FFFFFF,
BorderWidth = 1,
BackgroundColor = CSS_Color.MainBackgroundColor,
- Tag = function.functionCategory.ToString() + "-" + function.functionType
+ Tag = function.spk + function.sid
};
functionDiv.LoadFunctionDiv();
functionListView.AddChidren(functionDiv);
@@ -128,13 +152,33 @@
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);
+ };
}
}
}
\ No newline at end of file
--
Gitblit v1.8.0