From b5206a46345fa4326705b1178579e2de65edf5de Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期一, 20 五月 2024 15:01:05 +0800
Subject: [PATCH] 目标版本更新
---
HDL_ON/UI/UI2/2-Classification/FunctionPage.cs | 347 +++++++++++++++++++++++++++++++++++++++------------------
1 files changed, 237 insertions(+), 110 deletions(-)
diff --git a/HDL_ON/UI/UI2/2-Classification/FunctionPage.cs b/HDL_ON/UI/UI2/2-Classification/FunctionPage.cs
index dcff62d..c1e7d38 100644
--- a/HDL_ON/UI/UI2/2-Classification/FunctionPage.cs
+++ b/HDL_ON/UI/UI2/2-Classification/FunctionPage.cs
@@ -12,7 +12,7 @@
/// <summary>
/// 褰撳墠绐椾綋
/// </summary>
- static FrameLayout bodyView;
+ public static FunctionPage bodyView;
/// <summary>
/// 妤煎眰閫夋嫨涓嬫媺鍥炬爣
/// </summary>
@@ -28,18 +28,42 @@
#endregion
List<Function> functionList;
+ int titleId;
+ public Action DelAction;
public FunctionPage()
{
bodyView = this;
functionList = new List<Function>();
+
}
- public void LoadPage(int titleId)
+ /// <summary>
+ /// 閲嶈浇鐣岄潰
+ /// </summary>
+ public void ReLoadPage()
{
+ if (bodyView != null)
+ {
+ try
+ {
+ bodyView.RemoveAll();
+ LoadPage(this.titleId);
+ functionList = new List<Function>();
+ }
+ catch (Exception ex)
+ {
+ MainPage.Log($"FunctionPage ReloadPage error :\r\n {ex.Message}");
+ }
+ }
+ }
+
+ public void LoadPage(int titleId_out)
+ {
+ this.titleId = titleId_out;
bodyView.BackgroundColor = CSS_Color.BackgroundColor;
- if (titleId == StringId.Lights)
+ if (titleId == StringId.Lights && !DB_ResidenceData.Instance.HomeGateway.isSupportGroupControl)
{
Action action = () =>
{
@@ -60,50 +84,24 @@
skipView.LoadPage();
MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
};
- new TopViewDiv(bodyView, Language.StringByID(titleId)).LoadTopView_LightFunction(action);
+ var topView = new TopViewDiv(bodyView, Language.StringByID(titleId));
+ topView.maginY = 10;
+ topView.LoadTopView_LightFunction(action);
}
else
{
- new TopViewDiv(bodyView, Language.StringByID(titleId)).LoadTopView();
+ var topView = new TopViewDiv(bodyView, Language.StringByID(titleId));
+ topView.maginY = 10;
+ topView.LoadTopView();
}
-
-
-#if DEBUG
- //Button testBtn = new Button()
- //{
- // X = Application.GetRealWidth(80),
- // Height = Application.GetRealHeight(64),
- // BackgroundColor = 0xFFFF0000
- //};
- //bodyView.AddChidren(testBtn);
- //int ddd = 0;
- //testBtn.MouseUpEventHandler = (sender, e) => {
- // ddd++;
-
- // Function function_online = FunctionList.List.GetLightList().Find((obj) => obj.sid == "0001017DB92D2602020100010101");
- // if (ddd % 2 == 0)
- // {
- // function_online.online = true;
- // }
- // else
- // {
- // function_online.online = false;
- // }
- // HomePage.LoadEvent_RefreshDevcieOnline(function_online);
- // FunctionPage.UpdataOnline(function_online);
- // RoomPage.UpdataOnline(function_online);
-
-
- //};
-#endif
/// <summary>
/// 鎴块棿鍐呭鏄剧ず鍖哄煙
/// </summary>
var roomFloorChangeView = new FrameLayout()
{
- Y = Application.GetRealHeight(64),
+ Y = Application.GetRealHeight(64+10),
Height = Application.GetRealHeight(52),
};
bodyView.AddChidren(roomFloorChangeView);
@@ -134,25 +132,19 @@
functionListView = new VerticalScrolViewLayout()
{
- Y = Application.GetRealHeight(64 + 52),
- Height = Application.GetRealHeight(603 - 12 - 52),
+ Y = Application.GetRealHeight(64 + 52 +10),
+ Height = Application.GetRealHeight(603 - 12 - 52-10),
};
bodyView.AddChidren(functionListView);
if (titleId == StringId.Lights)
{
+ //functionList.AddRange(FunctionList.List.groupControls);
functionList.AddRange(FunctionList.List.GetLightList());
- var lightScene = FunctionList.List.scenes.FindAll((obj) => obj.sceneType == SceneType.LightScene);
-
- foreach (var scene in lightScene)
- {
- functionListView.AddChidren(new Button() { Height = Application.GetRealHeight(12) });
-
- var sceneRow = new SceneControlZone(scene);
- functionListView.AddChidren(sceneRow);
- sceneRow.LoadView();
- }
-
+ }
+ else if(titleId == StringId.HorseRaceLamp)
+ {
+ functionList.AddRange(FunctionList.List.GetSeries());
}
else if (titleId == StringId.AC)
{
@@ -168,7 +160,9 @@
}
else if (titleId == StringId.Electric)
{
+
functionList.AddRange(FunctionList.List.GetElectricals());
+
}
else if (titleId == StringId.EnvironmentalScience)
{
@@ -182,9 +176,17 @@
{
functionList.AddRange(FunctionList.List.GetAirFreshList());
}
- else if(titleId == StringId.MechanicalArm)
+ else if (titleId == StringId.MechanicalArm)
{
functionList.AddRange(FunctionList.List.GetMechanicalArmList());
+ }
+ else if (titleId == StringId.SecurityMonitoring)
+ {
+ functionList.AddRange(FunctionList.List.GetIpCamImouList());
+ }
+ else if(titleId == StringId.EnergyMonitoring)
+ {
+ functionList.AddRange(FunctionList.List.GetEnergyList());
}
functionList = functionList.OrderByDescending(o => o.controlCounter).ToList();
@@ -193,73 +195,198 @@
LoadDialog_ChangeFloor();
- #region 鍔犺浇缁勫悎璋冨厜鍦烘櫙
- if (titleId == StringId.Lights)
- {
- foreach (var lightScene in FunctionList.List.scenes)
- {
- if (lightScene.sceneType == SceneType.LightScene)
- if (lightScene != null)
- {
- functionListView.AddChidren(new Button() { Height = Application.GetRealHeight(12) });
- var sceneRow = new SceneControlZone(lightScene);
- functionListView.AddChidren(sceneRow);
- sceneRow.LoadView();
- }
- }
- }
- #endregion
+
}
-
+ /// <summary>
+ /// 鏄剧ず鐨勮澶囩殑鎬绘暟
+ /// </summary>
+ int showCount = -1;
/// <summary>
/// 鍔犺浇鍔熻兘row
/// </summary>
- void ShowFunctionRow(List<Function> showList)
+ void ShowFunctionRow(List<Function> showList, bool isAppend = false)
{
- functionListView.RemoveAll();
- foreach (var function in showList)
- {
- if(function.spk == SPK.SensorDryContact|| function.spk == SPK.SensorDryContact2)
- {
- continue;
- }
- if (function.spk == SPK.LightRGBW || function.spk == SPK.LightRGB || function.spk == SPK.LightDimming)
- {
- 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.spk + 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.spk + function.sid
- };
- functionDiv.LoadFunctionDiv();
- functionListView.AddChidren(functionDiv);
- }
- functionListView.AddChidren(new Button() { Height = Application.GetRealHeight(10) });
- }
- }
+ var waitPage = new Loading();
+ bodyView.AddChidren(waitPage);
+ waitPage.Start("");
+ new System.Threading.Thread(() =>
+ {
+ try
+ {
+ Application.RunOnMainThread(() =>
+ {
+ if (!isAppend)
+ {
+ showCount = -1;
+ functionListView.RemoveAll();
+ #region 鍔犺浇缁勫悎璋冨厜鍦烘櫙
+ if (titleId == StringId.Lights)
+ {
+ foreach (var lightScene in FunctionList.List.scenes)
+ {
+ if (lightScene.sceneType == SceneType.LightScene)
+ if (lightScene != null)
+ {
+ var sceneRow = new SceneControlZone(lightScene);
+ functionListView.AddChidren(sceneRow);
+ sceneRow.LoadView();
+ functionListView.AddChidren(new Button() { Height = Application.GetRealHeight(12) });
+ }
+ }
+ }
+ #endregion
+ }
+ for (var i = 0;i<50;i++)
+ //foreach (var function in showList)
+ {
+ showCount++;
+ if (showCount >= showList.Count)
+ {
+ break;
+ }
+ var function = showList[showCount];
+
+ if (function.spk == SPK.SensorDryContact || function.spk == SPK.SensorDryContact2)
+ {
+ continue;
+ }
+ if (function.spk == SPK.LightCCT || function.spk == SPK.LightRGBW || function.spk == SPK.LightRGB || function.spk == SPK.LightDimming)
+ {
+ var functionDiv = new FunctionControlZone(function,null)
+ {
+ 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.spk + function.sid
+ };
+ functionDiv.LoadFunctionDiv();
+ functionDiv.OrderEvent = OrderEvent;
+ functionListView.AddChidren(functionDiv);
+ }
+ else if (function.spk == SPK.IpCam_Imou)
+ {
+ var functionDiv = new FunctionControlZone(function,null)
+ {
+ 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.spk + function.sid
+ };
+ functionDiv.LoadFunctionDiv();
+ functionListView.AddChidren(functionDiv);
+
+ }
+ else if (function.spk == SPK.ElectricalTvHisense)
+ {
+ Action deviceDelAction = () =>
+ {
+ //鍒犻櫎璁惧鎴愬姛鍚庢洿鏂癠I
+ if (functionListView==null) {
+ return;
+ }
+ functionListView.RemoveAll();
+ showList.Remove(function);//鍏堢Щ闄�
+ ShowFunctionRow(showList,isAppend);
+ this.DelAction?.Invoke();
+
+ };
+ var functionDiv = new FunctionControlZone(function, deviceDelAction)
+ {
+ 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.spk + function.sid
+ };
+ functionDiv.LoadFunctionDiv();
+ functionDiv.OrderEvent = OrderEvent;
+ functionListView.AddChidren(functionDiv);
+ }
+ else
+ {
+ var functionDiv = new FunctionControlZone(function, null)
+ {
+ 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.spk + function.sid
+ };
+ functionDiv.LoadFunctionDiv();
+ functionDiv.OrderEvent = OrderEvent;
+ functionListView.AddChidren(functionDiv);
+ }
+ functionListView.AddChidren(new Button() { Height = Application.GetRealHeight(10) });
+ }
+ if (showList.Count > showCount)
+ {
+ var btnAppend = new Button()
+ {
+ Height = Application.GetRealHeight(60),
+ TextAlignment = TextAlignment.Center,
+ TextSize = CSS_FontSize.SubheadingFontSize,
+ TextColor = CSS_Color.FirstLevelTitleColor,
+ TextID = StringId.LoadMore,
+ };
+ functionListView.AddChidren(btnAppend);
+ btnAppend.MouseUpEventHandler = (sender, e) =>
+ {
+ btnAppend.RemoveFromParent();
+ ShowFunctionRow(showList, true);
+ };
+ }
+
+ });
+ }
+ catch (Exception ex)
+ {
+ MainPage.Log("ShowFunctionRowError : " + ex.Message);
+ }
+ finally
+ {
+ Application.RunOnMainThread(() =>
+ {
+ if (waitPage != null)
+ {
+ waitPage.RemoveFromParent();
+ waitPage = null;
+ }
+ });
+ }
+ })
+ { IsBackground = true }.Start();
+ }
+ /// <summary>
+ /// 鎺掑簭浜嬩欢
+ /// </summary>
+ void OrderEvent()
+ {
+ Action action = () =>
+ {
+ functionList = functionList.OrderBy(o => o.FunctionOrderNumber).ToList();
+ ShowFunctionRow(functionList);
+ };
+ var skipView = new OrderFunctionPage();
+ MainPage.BasePageView.AddChidren(skipView);
+ skipView.LoadPage(functionList, action);
+ MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+ }
///// <summary>
///// 鍔犺浇鍔熻兘绫诲瀷鎺у埗鍗$墖
--
Gitblit v1.8.0