From 0a11352dffeb8d5f31dd40b9728fe1abf4537f04 Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期五, 01 九月 2023 18:06:45 +0800
Subject: [PATCH] 2023年09月01日18:06:42

---
 HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs |  154 +++++++++++++++++++++++----------------------------
 1 files changed, 69 insertions(+), 85 deletions(-)

diff --git a/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs b/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs
index 3bf20a9..fa26fd2 100644
--- a/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs
+++ b/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs
@@ -33,7 +33,7 @@
                                     }
                                     if (btn.Tag.ToString() == function.sid)
                                     {
-                                        if (function.online)
+                                        if (function.isOnline())
                                         {
                                             btn.UnSelectedImagePath = "Collection/Functionbg.png";
                                             btn.IsSelected = false;
@@ -46,7 +46,7 @@
                                     }
                                     else if (btn.Tag.ToString() == "OnlineTag")
                                     {
-                                        btn.Visible = !function.online;
+                                        btn.Visible = !function.isOnline();
                                     }
                                 }
                             }
@@ -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>
@@ -568,7 +546,7 @@
         {
             btnSwitch.MouseUpEventHandler = (sender, e) =>
             {
-                if (!function.online)//绂荤嚎涓嶅厑璁告搷浣�
+                if (!function.isOnline())//绂荤嚎涓嶅厑璁告搷浣�
                 {
                     new Tip()
                     {
@@ -588,6 +566,7 @@
                             btnSwitch.IsSelected = !btnSwitch.IsSelected;
                         });
                     }
+                   
                     function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off";
                     Dictionary<string, string> d = new Dictionary<string, string>();
                     if (function.spk == SPK.LightDimming || function.spk == SPK.LightRGB)
@@ -612,6 +591,11 @@
                     //    }
                     //    Control.Ins.SendWriteCommand(function, d);
                     //}
+                    else if (function.spk == SPK.GroupControl)
+                    {
+                        d.Add("on_off", function.trait_on_off.curValue.ToString());
+                        (function as GroupControl).Control(d);
+                    }
                     else
                     {
                         d.Add("on_off", function.trait_on_off.curValue.ToString());
@@ -631,7 +615,7 @@
         {
             btnSwitch.MouseUpEventHandler = (sender, e) =>
             {
-                if (!function.online)//绂荤嚎涓嶅厑璁告搷浣�
+                if (!function.isOnline())//绂荤嚎涓嶅厑璁告搷浣�
                 {
                     new Tip()
                     {
@@ -675,16 +659,16 @@
         {
             btnClose.MouseUpEventHandler = (sender, e) =>
             {
-                if (!curtain.online)//绂荤嚎涓嶅厑璁告搷浣�
-                {
-                    new Tip()
-                    {
-                        CloseTime = 1,
-                        Text = Language.StringByID(StringId.DeviceOfflineCannotOption),
-                        Direction = AMPopTipDirection.None,
-                    }.Show(MainPage.BaseView);
-                    return;
-                }
+                //if (!curtain.isOnline())//绂荤嚎涓嶅厑璁告搷浣�
+                //{
+                //    new Tip()
+                //    {
+                //        CloseTime = 1,
+                //        Text = Language.StringByID(StringId.DeviceOfflineCannotOption),
+                //        Direction = AMPopTipDirection.None,
+                //    }.Show(MainPage.BaseView);
+                //    return;
+                //}
                 btnClose.IsSelected = true;
                 curtain.trait_on_off.curValue = "off";
                 curtain.SetAttrState(FunctionAttributeKey.Percent, 0);
@@ -695,16 +679,16 @@
 
             btnOpen.MouseUpEventHandler = (sender, e) =>
             {
-                if (!curtain.online)//绂荤嚎涓嶅厑璁告搷浣�
-                {
-                    new Tip()
-                    {
-                        CloseTime = 1,
-                        Text = Language.StringByID(StringId.DeviceOfflineCannotOption),
-                        Direction = AMPopTipDirection.None,
-                    }.Show(MainPage.BaseView);
-                    return;
-                }
+                //if (!curtain.isOnline())//绂荤嚎涓嶅厑璁告搷浣�
+                //{
+                //    new Tip()
+                //    {
+                //        CloseTime = 1,
+                //        Text = Language.StringByID(StringId.DeviceOfflineCannotOption),
+                //        Direction = AMPopTipDirection.None,
+                //    }.Show(MainPage.BaseView);
+                //    return;
+                //}
                 btnOpen.IsSelected = true;
                 curtain.trait_on_off.curValue = "on";
                 curtain.SetAttrState(FunctionAttributeKey.Percent, 100);
@@ -725,7 +709,7 @@
             };
             btnUp.MouseUpEventHandler = (sender, e) =>
             {
-                if (!function.online)//绂荤嚎涓嶅厑璁告搷浣�
+                if (!function.isOnline())//绂荤嚎涓嶅厑璁告搷浣�
                 {
                     new Tip()
                     {
@@ -756,7 +740,7 @@
             };
             btnDown.MouseUpEventHandler = (sender, e) =>
             {
-                if (!function.online)//绂荤嚎涓嶅厑璁告搷浣�
+                if (!function.isOnline())//绂荤嚎涓嶅厑璁告搷浣�
                 {
                     new Tip()
                     {
@@ -801,9 +785,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;
         }
 
@@ -888,8 +872,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;
         }
 
@@ -899,8 +883,8 @@
         void ResetMesBtnRead()
         {
             if (bodyView == null) return;
-            btnMsg.Text = "...";
-            btnMsgTime.Text = "00:00";
+            //btnMsg.Text = "...";
+            //btnMsgTime.Text = "00:00";
             btnMsgIcon.IsSelected = false;
         }
 

--
Gitblit v1.8.0