From b69d7735274b8d0f741da8a6bb8b8e1347477a5a Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期四, 19 三月 2020 17:14:16 +0800
Subject: [PATCH] 20200319

---
 HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs |   79 +++++++++++++++++++++++++++++++++++++--
 1 files changed, 74 insertions(+), 5 deletions(-)

diff --git a/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs b/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs
index e846ab5..68c3f2e 100644
--- a/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs
+++ b/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs
@@ -4,8 +4,72 @@
 
 namespace HDL_ON.UI
 {
+
+
     public partial class HomePage
     {
+
+        /// <summary>
+        /// 淇敼鏄剧ず鐨勫姛鑳界被鍨�
+        /// 璁惧鍔熻兘/鍦烘櫙鍔熻兘
+        /// </summary>
+        void LoadEvent_ChangeShowedFunctionType()
+        {
+            btnChangeFunction.MouseUpEventHandler = (sender, e) =>
+            {
+                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;
+            };
+
+            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;
+                    CurShowTypeIsFunction = true;
+                }
+                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;
+                    CurShowTypeIsFunction = false;
+                }
+            };
+        }
+
+
+
+        /// <summary>
+        /// 鏇存柊鐏厜鏄剧ず鐘舵��
+        /// </summary>
+        /// <param name="light"></param>
         public static void UpdataLightView(Light light)
         {
             Application.RunOnMainThread(() =>
@@ -16,7 +80,7 @@
                     {
                         if (dic.Key == light.sid)
                         {
-                            var state = light.state == 1;
+                            var state = light.on_off == 1;
                             var view = dic.Value;
                             for (int i = 0; i < view.ChildrenCount; i++)
                             {
@@ -36,8 +100,13 @@
             });
         }
 
-
-        void LoadSwitchEvent(Function function,Button btnSwitch,FrameLayout view)
+        /// <summary>
+        /// 鍔犺浇缁х數鍣ㄥ紑鍏充簨浠�
+        /// </summary>
+        /// <param name="function"></param>
+        /// <param name="btnSwitch"></param>
+        /// <param name="view"></param>
+        void LoadRelaySwitchEvent(Function function, Button btnSwitch, FrameLayout view)
         {
 
             btnSwitch.MouseUpEventHandler += (sender, e) =>
@@ -56,8 +125,8 @@
                     new System.Threading.Thread(() =>
                     {
                         var light = function as Light;
-                        light.state = btnSwitch.IsSelected ? 1 : 0;
-                        Control.Send("write", function, 3);
+                        light.on_off = btnSwitch.IsSelected ? 1 : 0;
+                        Control.Send("write", function);
                     })
                     { IsBackground = true }.Start();
                 }

--
Gitblit v1.8.0