From 9508510f0b27da3278fa1161eb2ba3dd1e3e2030 Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期三, 26 七月 2023 13:14:00 +0800
Subject: [PATCH] 2023年07月26日13:12:21

---
 HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs |  140 ++++++++++++++++++++++++----------------------
 1 files changed, 73 insertions(+), 67 deletions(-)

diff --git a/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs b/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs
index dbba017..649b4c8 100644
--- a/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs
+++ b/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs
@@ -238,6 +238,25 @@
         }
 
         /// <summary>
+        /// 鏇存柊鍔熻兘缁勬帶涓婚〉
+        /// </summary>
+        public static void RefreshGroupControlView()
+        {
+            if (bodyView != null)
+            {
+
+                if (FunctionList.List.groupControls.Count == 0)
+                {
+                    bodyView.loadNavView();
+                    bodyView.contentView.PageIndex = 0;
+                }
+                bodyView.LoadGroupControlFunctionControlZone();
+            }
+        }
+
+
+
+        /// <summary>
         /// 鏇存柊杩炴帴鐘舵�佸浘鏍�
         /// </summary>
         void CheckLinkStatus()
@@ -269,9 +288,15 @@
         {
             Application.RunOnMainThread(() =>
             {
-                if (bodyView != null)
+                try
                 {
-                    bodyView.CheckLinkStatus();
+                    if (bodyView != null)
+                    {
+                        bodyView.CheckLinkStatus();
+                    }
+                }catch(Exception ex)
+                {
+                    MainPage.Log($"LoadEvent_CheckLinkStatus : {ex.Message}");
                 }
             });
         }
@@ -319,58 +344,11 @@
         /// </summary>
         void LoadEvent_ChangeShowedFunctionType()
         {
-            btnChangeFunction.MouseUpEventHandler = (sender, e) =>
+           
+            if (DB_ResidenceData.Instance.HomeGateway.isSupportGroupControl && FunctionList.List.groupControls.Count>0)
             {
-                btnChangeFunction.IsSelected = true;
-                btnChangeFunction.TextSize = CSS.CSS_FontSize.HeadlineFontSize;
-                btnChangeFunction.IsBold = true;
-                btnChangeScene.TextSize = CSS.CSS_FontSize.TextFontSize;
-                btnChangeScene.IsSelected = false;
-                btnChangeScene.IsBold = false;
-                CurShowTypeIsFunction = true;
-                contentView.PageIndex = 0;
-            };
 
-            //var client = new BlufiClient();
-            //client.PostPackageLengthLimit = 128;
-            //client.RequestDeviceScan();
-            //client.RequestDeviceStatus();
-            //client.BlufiDelegate.Blufi_DidReceiveDeviceScanResponse();
-
-
-            btnChangeScene.MouseUpEventHandler = (sender, e) =>
-            {
-                btnChangeScene.IsSelected = true;
-                btnChangeScene.TextSize = CSS.CSS_FontSize.HeadlineFontSize;
-                btnChangeScene.IsBold = true;
-                btnChangeFunction.TextSize = CSS.CSS_FontSize.TextFontSize;
-                btnChangeFunction.IsSelected = false;
-                btnChangeFunction.IsBold = false;
-                CurShowTypeIsFunction = false;
-                contentView.PageIndex = 1;
-            };
-
-            contentView.PageChange = (sender, e) =>
-            {
-                if (contentView.PageIndex == 0)
-                {
-                    btnChangeFunction.IsSelected = true;
-                    btnChangeFunction.TextSize = CSS.CSS_FontSize.HeadlineFontSize;
-                    btnChangeFunction.IsBold = true;
-                    btnChangeScene.TextSize = CSS.CSS_FontSize.TextFontSize;
-                    btnChangeScene.IsSelected = false;
-                    btnChangeScene.IsBold = false;
-                }
-                else
-                {
-                    btnChangeScene.IsSelected = true;
-                    btnChangeScene.TextSize = CSS.CSS_FontSize.HeadlineFontSize;
-                    btnChangeScene.IsBold = true;
-                    btnChangeFunction.TextSize = CSS.CSS_FontSize.TextFontSize;
-                    btnChangeFunction.IsSelected = false;
-                    btnChangeFunction.IsBold = false;
-                }
-            };
+            }
         }
 
         /// <summary>
@@ -408,7 +386,7 @@
                                         state = function.trait_on_off.curValue.ToString() == "on";
                                     }
                                 }
-                                else if (function.spk == SPK.SenesorMegahealth)
+                                else if (function.spk == SPK.SenesorMegahealth || function.spk == SPK.SensorMmvPose)
                                 {
 
                                     var tempStatus = function.attributes.Find((sta) => sta.key == FunctionAttributeKey.TargetStatus);
@@ -446,6 +424,14 @@
                                         }
                                     }
                                 }
+                                else if(function.spk == SPK.SensorHelp)
+                                {
+                                    var tempStatus = function.attributes.Find((sta) => sta.key == FunctionAttributeKey.AlarmStatus);
+                                    if(tempStatus != null)
+                                    {
+                                        state = tempStatus.curValue.ToString() == "alarm";
+                                    }
+                                }
                                 else
                                 {
                                     state = function.trait_on_off.curValue.ToString() == "on";
@@ -466,7 +452,14 @@
                                             {
                                                 if (function.spk != SPK.LightSwitch)
                                                 {
-                                                    btn.Text = function.lastState;
+                                                    if (function.spk == SPK.SensorHelp)
+                                                    {
+                                                        btn.TextID = StringId.InAlarming;
+                                                    }
+                                                    else
+                                                    {
+                                                        btn.Text = function.lastState;
+                                                    }
                                                 }
                                             }
                                         }
@@ -589,13 +582,18 @@
                         d.Add(FunctionAttributeKey.FadeTime, function.GetAttrState(FunctionAttributeKey.FadeTime));
                         Control.Ins.SendWriteCommand(function, d);
                     }
-                    else if (function.spk == SPK.PanelSocket)
+                    //else if (function.spk == SPK.PanelSocket)//鍘绘帀锛岀粺涓�澶勭悊鎬绘帶
+                    //{
+                    //    if (function.attributes.Find((obj) => obj.key == "on_off_usb") != null)
+                    //    {
+                    //        d.Add("on_off_usb", function.trait_on_off.curValue.ToString());
+                    //    }
+                    //    Control.Ins.SendWriteCommand(function, d);
+                    //}
+                    else if (function.spk == SPK.GroupControl)
                     {
-                        if (function.attributes.Find((obj) => obj.key == "on_off_usb") != null)
-                        {
-                            d.Add("on_off_usb", function.trait_on_off.curValue.ToString());
-                        }
-                        Control.Ins.SendWriteCommand(function, d);
+                        d.Add("on_off", function.trait_on_off.curValue.ToString());
+                        (function as GroupControl).Control(d);
                     }
                     else
                     {
@@ -786,9 +784,9 @@
                 skipPage.LoadPage(backAction);
                 MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
             };
-            btnMsgBg.MouseUpEventHandler = eventHandler;
-            btnMsgTime.MouseUpEventHandler = eventHandler;
-            btnMsg.MouseUpEventHandler = eventHandler;
+            //btnMsgBg.MouseUpEventHandler = eventHandler;
+            //btnMsgTime.MouseUpEventHandler = eventHandler;
+            //btnMsg.MouseUpEventHandler = eventHandler;
             btnMsgIcon.MouseUpEventHandler = eventHandler;
         }
 
@@ -803,6 +801,10 @@
         /// </summary>
         void GetUnreadPushMessages()
         {
+            if (MainPage.NoLoginMode)
+            {
+                return;
+            }
             System.Threading.Tasks.Task.Run(() =>
             {
                 try
@@ -869,8 +871,8 @@
         void ShowMesBtnState(PushMessageInfo pushMessageInfo, bool allRead)
         {
             if (bodyView == null) return;
-            btnMsg.Text = pushMessageInfo.messageTitle + ": " + pushMessageInfo.messageContent;
-            btnMsgTime.Text = GetUnixToDateTime(pushMessageInfo.createTime);
+            //btnMsg.Text = pushMessageInfo.messageTitle + ": " + pushMessageInfo.messageContent;
+            //btnMsgTime.Text = GetUnixToDateTime(pushMessageInfo.createTime);
             btnMsgIcon.IsSelected = !allRead;
         }
 
@@ -880,8 +882,8 @@
         void ResetMesBtnRead()
         {
             if (bodyView == null) return;
-            btnMsg.Text = "...";
-            btnMsgTime.Text = "00:00";
+            //btnMsg.Text = "...";
+            //btnMsgTime.Text = "00:00";
             btnMsgIcon.IsSelected = false;
         }
 
@@ -907,6 +909,10 @@
         /// </summary>
         void RegisterGetPushMessageAction()
         {
+            if (MainPage.NoLoginMode)
+            {
+                return;
+            }
             Action RegisterGetPushMessageAction = () => {
                 if (bodyView != null)
                 {

--
Gitblit v1.8.0