From 753e67c3705dddb8e913bd853db151f94f81d600 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期一, 05 六月 2023 09:45:05 +0800
Subject: [PATCH] Merge branch 'Dev-Wxr'

---
 HDL_ON/UI/UI2/1-HomePage/HomePage.cs |   54 ++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 38 insertions(+), 16 deletions(-)

diff --git a/HDL_ON/UI/UI2/1-HomePage/HomePage.cs b/HDL_ON/UI/UI2/1-HomePage/HomePage.cs
index 788f78b..4f2d2b4 100644
--- a/HDL_ON/UI/UI2/1-HomePage/HomePage.cs
+++ b/HDL_ON/UI/UI2/1-HomePage/HomePage.cs
@@ -289,7 +289,7 @@
                             deviceId = enviTemp.deviceId,
                             attributes = new List<FunctionAttributes> { new FunctionAttributes { key = "value", state = humiAttr.state, curValue = humiAttr.curValue } },
                         };
-                        humiSensorList.Add(newTemp);
+                        humiSensorList.Add(newTemp);//020103CF594C3E00051F0001051F//	1650546588519424001
                     }
                     var tempAttr = enviTemp.attributes.Find((obj) => obj.key == "temperature");
                     if (tempAttr != null)
@@ -301,7 +301,7 @@
                             deviceId = enviTemp.deviceId,
                             attributes = new List<FunctionAttributes> { new FunctionAttributes { key = "value", state = tempAttr.state, curValue = tempAttr.curValue } },
                         };
-                        tempSensorList.Add(newTemp);
+                        tempSensorList.Add(newTemp);//020103CF594C3E00051F0001051F
                     }
                 }
 
@@ -359,7 +359,10 @@
                     foreach (var temp in tempSensorList)
                     {
                         double tempValue = 0;
-                        double.TryParse(temp.GetAttrState("temperature"), out tempValue);
+                        if (temp.GetAttribute("temperature") != null)
+                            double.TryParse(temp.GetAttrState("temperature"), out tempValue);
+                        else
+                            double.TryParse(temp.GetAttrState("value"), out tempValue);
                         if (tempValue > 0)
                         {
                             tempTotalValues += tempValue;
@@ -413,7 +416,10 @@
                     foreach (var humi in humiSensorList)
                     {
                         double humiValue = 0;
-                        double.TryParse(humi.GetAttrState("humidity"), out humiValue);
+                        if (humi.GetAttribute("temperature") != null)
+                            double.TryParse(humi.GetAttrState("humidity"), out humiValue);
+                        else
+                            double.TryParse(humi.GetAttrState("value"), out humiValue);
                         if (humiValue > 0)
                         {
                             humiTotalValues += humiValue;
@@ -724,7 +730,9 @@
             try
             {
                 int index = 0;
-                var list = FunctionList.List.GetDeviceFunctionList();
+                var list = new List<Function>();
+                list.AddRange(FunctionList.List.GetDeviceFunctionList());
+                list.AddRange(FunctionList.List.groupControls);//鍔犲叆缇ゆ帶
                 foreach (var function in list)
                 {
                     //闊充箰妯″潡鏈変富浠庡叧绯伙紝闇�瑕佺壒娈婂鐞�
@@ -1023,6 +1031,7 @@
                         btnState.Text = function.lastState;
                     }
                 }
+                
                 else
                 {
                     btnIcon.UnSelectedImagePath = $"FunctionIcon/Icon/HomeIcon/{function.IconName}_blue.png";
@@ -1055,7 +1064,7 @@
                 if (//SPK.CurtainSpkList().Contains(function.spk))
                     function.spk == SPK.CurtainRoller || function.spk == SPK.CurtainShades ||
                     function.spk == SPK.CurtainDream ||
-                    function.spk == SPK.CurtainSwitch || function.spk == SPK.CurtainTrietex )
+                    function.spk == SPK.CurtainSwitch || function.spk == SPK.CurtainTrietex)
                 {
                     btnIcon.UnSelectedImagePath = "FunctionIcon/Curtain/CurtainIcon.png";
                     btnIcon.SelectedImagePath = "FunctionIcon/Curtain/CurtainOnIcon.png";
@@ -1140,7 +1149,7 @@
                             btnPower.IsSelected = true;
                             status = "on";
                         }
-                       function.SetAttrState("on_off", status);
+                        function.SetAttrState("on_off", status);
                         Dictionary<string, string> dic = new Dictionary<string, string>();
                         dic.Add("on_off", status);
                         Music.SendMethod.Current.SendControlCommand(function, dic);
@@ -1154,7 +1163,7 @@
                     Button btnUp;
                     btnUp = new Button()
                     {
-                        X = Application.GetRealWidth(84+3),
+                        X = Application.GetRealWidth(84 + 3),
                         Y = Application.GetRealWidth(89),
                         Width = Application.GetRealWidth(38),
                         Height = Application.GetRealWidth(38),
@@ -1179,7 +1188,7 @@
                     LoadEvent_ControlClothesHanger(function, btnUp, btnDown);
 
                 }
-                
+
                 else if (function.spk == SPK.SenesorMegahealth || function.spk == SPK.SensorMmvPose)
                 {
                     //btnIcon.UnSelectedImagePath = $"FunctionIcon/Icon/HomeIcon/{function.IconName}.png";
@@ -1202,7 +1211,16 @@
                     btnIcon.UnSelectedImagePath = $"FunctionIcon/Icon/HomeIcon/{function.IconName}_blue.png";
                     btnIcon.SelectedImagePath = $"FunctionIcon/Icon/HomeIcon/{function.IconName}_blue.png";
                 }
-
+                else if (function.spk == SPK.VideoDoorLock)
+                {
+                    btnIcon.UnSelectedImagePath = UI2.FuntionControlView.VideoDoorLock.CommonMethod.Current.GetVideoDoorLockIcon(UI2.FuntionControlView.VideoDoorLock.CommonMethod.Comerom.collect);
+                    //btnIcon.SelectedImagePath = $"FunctionIcon/Icon/HomeIcon/{function.IconName}_blue.png";
+                }
+                else if (function.spk == SPK.GroupControl)
+                {
+                    btnIcon.UnSelectedImagePath = $"FunctionIcon/Icon/HomeIcon/lightswitch_blue.png";
+                    btnIcon.SelectedImagePath = $"FunctionIcon/Icon/HomeIcon/lightswitch_white.png";
+                }
                 else
                 {
                     Button btnSwitch;
@@ -1216,7 +1234,6 @@
                         SelectedImagePath = "Public/SwitchOn.png",
                     };
                     view.AddChidren(btnSwitch);
-
                     btnIcon.UnSelectedImagePath = $"FunctionIcon/Icon/HomeIcon/{function.IconName}_blue.png";
                     btnIcon.SelectedImagePath = $"FunctionIcon/Icon/HomeIcon/{function.IconName}_white.png";
                     LoadEvent_SwitchFunction(function, btnSwitch);
@@ -1238,7 +1255,9 @@
                 };
 
 
-                var skipControlPageEvent = new PublicAssmebly().LoadEvent_SkipFunctionControlPage(function, btnCollection, btnName, btnZone);
+                var skipControlPageEvent = new PublicAssmebly().LoadEvent_SkipFunctionControlPage(function, btnCollection, btnName, btnZone, UI2.FuntionControlView.VideoDoorLock.CommonMethod.Comerom.collect,()=> {
+                    this.LoadDeviceFunctionControlZone();//鍒犻櫎璁惧鍚庨噸鏂板埛鏂癠I
+                });
                 view.MouseUpEventHandler = skipControlPageEvent;
                 btnName.MouseUpEventHandler = skipControlPageEvent;
                 btnIcon.MouseUpEventHandler = skipControlPageEvent;
@@ -1452,11 +1471,14 @@
 
                 LoadEvent_ControlScene(btnCoverd, btnName, btnZone, btnShowDelay, scene);
 
-                btnSettingIcon.MouseUpEventHandler = (sender, e) => {
-                    Action backAction = () => {
+                btnSettingIcon.MouseUpEventHandler = (sender, e) =>
+                {
+                    Action backAction = () =>
+                    {
                         //LoadSceneFunctionControlZone();
                     };
-                    Action refreshAction = () => {
+                    Action refreshAction = () =>
+                    {
                         btnName.Text = scene.name;
                         btnZone.Text = scene.GetRoomListName();
                         //view.BackgroundImagePath = (scene as Scene).ImagePath;
@@ -1465,7 +1487,7 @@
                     };
                     var aep = new SceneEditPage(scene, backAction);
                     MainPage.BasePageView.AddChidren(aep);
-                    aep.LoadPage( refreshAction);
+                    aep.LoadPage(refreshAction);
                     MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                 };
                 //鍦烘櫙姝e湪鍊掕鏃舵墽琛屼腑

--
Gitblit v1.8.0