From a5ba89efa83d0a4afd0d25dbeba5989e4944b5b8 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期二, 24 十一月 2020 18:57:56 +0800
Subject: [PATCH] 20201124;mqtt代码整理备份

---
 HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs |   51 ++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 40 insertions(+), 11 deletions(-)

diff --git a/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs b/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs
index 7a6ec71..21782a6 100644
--- a/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs
+++ b/HDL_ON/UI/UI2/1-HomePage/HomePageBLL.cs
@@ -1,4 +1,5 @@
 锘縰sing System;
+using HDL_ON.DriverLayer;
 using HDL_ON.Entity;
 using Shared;
 
@@ -11,9 +12,39 @@
         /// </summary>
         public static void LoadEvent_RefreshAir()
         {
-            bodyView.btnTempValues.Text = MainPage.cityInfo.temperature == null ? "--" : MainPage.cityInfo.temperature + "掳";
-            bodyView.btnHumidityValues.Text = MainPage.cityInfo.humidity == null ? "--" : MainPage.cityInfo.humidity + "%";
-            bodyView.btnPm25Values.Text = MainPage.cityInfo.pm25 == null ? "--" : MainPage.cityInfo.pm25;
+            if (bodyView != null)
+            {
+                bodyView.btnTempValues.Text = MainPage.cityInfo.temperature == null ? "--" : MainPage.cityInfo.temperature + "掳";
+                bodyView.btnHumidityValues.Text = MainPage.cityInfo.humidity == null ? "--" : MainPage.cityInfo.humidity + "%";
+                bodyView.btnPm25Values.Text = MainPage.cityInfo.pm25 == null ? "--" : MainPage.cityInfo.pm25;
+            }
+        }
+        /// <summary>
+        /// 纭杩炴帴鐘舵��
+        /// </summary>
+        public static void LoadEvent_CheckLinkStatus()
+        {
+            if (bodyView != null)
+            {
+                Application.RunOnMainThread(() =>
+                {
+                    if (Control.Ins.GatewayOnline)
+                    {
+                        if (Control.Ins.IsRemote)
+                        {
+                            bodyView.btnLinkStateTip.BackgroundColor = CSS.CSS_Color.LinkTipRemote;
+                        }
+                        else
+                        {
+                            bodyView.btnLinkStateTip.BackgroundColor = CSS.CSS_Color.MainColor;
+                        }
+                    }
+                    else
+                    {
+                        bodyView.btnLinkStateTip.BackgroundColor = CSS.CSS_Color.LinkTipFail;
+                    }
+                });
+            }
         }
 
         /// <summary>
@@ -157,7 +188,7 @@
             {
                 string msg = function.name + Language.StringByID(StringId.AlreadyOpened);
                 new PublicAssmebly().TipMsgAutoClose(msg, true);
-                Control.Send(function as Scene);
+                Control.Ins.ControlScene(function as Scene);
             };
             btnCoverd.MouseUpEventHandler = eventHandler;
             btnName.MouseUpEventHandler = eventHandler;
@@ -177,11 +208,9 @@
                 new System.Threading.Thread(() =>
                 {
                     function.trait_on_off.value = btnSwitch.IsSelected ? "on" : "off";
-                    //Control.Send(CommandType_A.write, function);
                     System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
                     d.Add("on_off", function.trait_on_off.value.ToString());
-                    Control.SendWriteCommand(function, d);
-
+                    Control.Ins.SendWriteCommand(function, d);
                 })
                 { IsBackground = true }.Start();
             };
@@ -212,10 +241,10 @@
             {
                 btnClose.IsSelected = false;
                 curtain.trait_on_off.value = "off";
-                //Control.Send(CommandType_A.write, curtain);
+                curtain.percent = 0;
                 System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
                 d.Add("on_off",curtain.trait_on_off.value.ToString());
-                Control.SendWriteCommand(curtain, d);
+                Control.Ins.SendWriteCommand(curtain, d);
             };
 
             btnOpen.MouseDownEventHandler = (sender, e) =>
@@ -226,10 +255,10 @@
             {
                 btnOpen.IsSelected = false;
                 curtain.trait_on_off.value = "on";
-                //Control.Send(CommandType_A.write, curtain);
+                curtain.percent = 100;
                 System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
                 d.Add("on_off", curtain.trait_on_off.value.ToString());
-                Control.SendWriteCommand(curtain, d);
+                Control.Ins.SendWriteCommand(curtain, d);
             };
         }
 

--
Gitblit v1.8.0