From d72ca686a3e262693f8a6e45e747e8e8da43335b Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期二, 06 七月 2021 09:39:03 +0800
Subject: [PATCH] 2021-07-06 1.更新

---
 HDL_ON/UI/UI2/FuntionControlView/Electrical/ClothesHangerPage.cs |   77 ++++++++++++++++++--------------------
 1 files changed, 36 insertions(+), 41 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/Electrical/ClothesHangerPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Electrical/ClothesHangerPage.cs
index 6454ccb..0a3c074 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Electrical/ClothesHangerPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Electrical/ClothesHangerPage.cs
@@ -64,8 +64,6 @@
             //鍒濆鍖栫涓�涓储寮曢〉鐨勫唴瀹�
             this.InitFrameWhiteContent1();
 
-            //鍒锋柊褰撳墠璁惧鐨勭姸鎬佺紦瀛�
-            this.RefreshNowDeviceStatuMemory(this.device);
             //鍒锋柊鐣岄潰鐘舵��
             this.RefreshFormStatu();
             //璇诲彇鐘舵��
@@ -366,8 +364,6 @@
             //涓嶆槸鍚屼竴涓笢瑗�
             if (this.device.sid != i_LocalDevice.sid) { return; }
 
-            //鍒锋柊褰撳墠璁惧鐨勭姸鎬佺紦瀛�
-            this.RefreshNowDeviceStatuMemory(i_LocalDevice);
             //鍒锋柊鐣岄潰鐘舵��
             this.RefreshFormStatu();
         }
@@ -389,46 +385,44 @@
             {
                 btnIcon.IsSelected = true;
                 #region 鐐逛寒鏂囨湰
-                var hotDryTemp = device.status.Find((sta) => sta.key == FunctionAttributeKey.HotDry);
+                var hotDryTemp = device.attributes.Find((sta) => sta.key == FunctionAttributeKey.HotDry);
                 if (hotDryTemp != null)
                 {
-                    hotDryView.SetViewStatus(hotDryTemp.value == "true");
+                    hotDryView.SetViewStatus(hotDryTemp.state == "true");
                 }
-                var windDryTemp = device.status.Find((sta) => sta.key == FunctionAttributeKey.WindDry);
+                var windDryTemp = device.attributes.Find((sta) => sta.key == FunctionAttributeKey.WindDry);
                 if (windDryTemp != null)
                 {
-                    windDryView.SetViewStatus(windDryTemp.value == "true");
+                    windDryView.SetViewStatus(windDryTemp.state == "true");
                 }
-                var disinfectTemp = device.status.Find((sta) => sta.key == FunctionAttributeKey.Disinfect);
+                var disinfectTemp = device.attributes.Find((sta) => sta.key == FunctionAttributeKey.Disinfect);
                 if (disinfectTemp != null)
                 {
-                    disinfectView.SetViewStatus(disinfectTemp.value == "true");
+                    disinfectView.SetViewStatus(disinfectTemp.state == "true");
                 }
-                var lightTemp = device.status.Find((sta) => sta.key == FunctionAttributeKey.OnOff);
+                var lightTemp = device.attributes.Find((sta) => sta.key == FunctionAttributeKey.OnOff);
                 if (lightTemp != null)
                 {
-                    lightingView.SetViewStatus(lightTemp.value == "on");
+                    lightingView.SetViewStatus(lightTemp.state == "on");
                 }
+                MainPage.Log($"鏃堕棿鎴筹細{device.time_stamp}  鏃堕棿锛歿device.GeteTime()} 鐑樺共:{hotDryTemp.state} 椋庡共:{windDryTemp.state} 娑堟瘨:{disinfectTemp.state} 鐏厜鐘舵�侊細{lightTemp.state}");
                 #endregion
 
                 #region 淇敼鏃堕棿
-                var hotDryTimeLeftTemp = device.status.Find((sta) => sta.key == FunctionAttributeKey.HotDryTimeLeft);
+                var hotDryTimeLeftTemp = device.attributes.Find((sta) => sta.key == FunctionAttributeKey.HotDryTimeLeft);
                 if (hotDryTimeLeftTemp != null)
                 {
-                    hotDryView.ChangeTime(hotDryTimeLeftTemp.value);
-                    MainPage.Log($"鐑樺共鍓╀綑鏃堕棿{hotDryTimeLeftTemp.value}");
+                    hotDryView.ChangeTime(hotDryTimeLeftTemp.state);
                 }
-                var windDryTimeLeftTemp = device.status.Find((sta) => sta.key == FunctionAttributeKey.WindDryTimeLeft);
+                var windDryTimeLeftTemp = device.attributes.Find((sta) => sta.key == FunctionAttributeKey.WindDryTimeLeft);
                 if (windDryTimeLeftTemp != null)
                 {
-                    windDryView.ChangeTime(windDryTimeLeftTemp.value);
-                    MainPage.Log($"椋庡共鍓╀綑鏃堕棿{windDryTimeLeftTemp.value}");
+                    windDryView.ChangeTime(windDryTimeLeftTemp.state);
                 }
-                var disinfectTimeLeftTemp = device.status.Find((sta) => sta.key == FunctionAttributeKey.DisinfectTimeLeft);
+                var disinfectTimeLeftTemp = device.attributes.Find((sta) => sta.key == FunctionAttributeKey.DisinfectTimeLeft);
                 if (disinfectTimeLeftTemp != null)
                 {
-                    disinfectView.ChangeTime(disinfectTimeLeftTemp.value);
-                    MainPage.Log($"娑堟瘨鍓╀綑鏃堕棿{disinfectTimeLeftTemp.value}");
+                    disinfectView.ChangeTime(disinfectTimeLeftTemp.state);
                 }
                 #endregion
 
@@ -439,18 +433,6 @@
         #endregion
 
         #region 鈻� 涓�鑸柟娉昣__________________________
-
-        /// <summary>
-        /// 鍒锋柊褰撳墠璁惧鐨勭姸鎬佺紦瀛�
-        /// </summary>
-        private void RefreshNowDeviceStatuMemory(Function i_LocalDevice)
-        {
-            foreach (var data in i_LocalDevice.status)
-            {
-                //寮�鍏�
-                //if (data.key == "on_off") { this.weepRobotData.Cleaning = data.value.ToLower() == "on"; }
-            }
-        }
 
         #endregion
     }
@@ -468,8 +450,6 @@
         /// 鎺т欢鏄惁鐐逛寒
         /// </summary>
         public bool Lighting = false;
-
-
 
         public ClothesHangerControl(string iconPath1, string iconPath2, string title, string time)
         {
@@ -497,7 +477,7 @@
             btnTime = new Button()
             {
                 Gravity = Gravity.CenterHorizontal,
-                Y = btnTitle.Bottom,
+                Y = Application.GetRealHeight(74-32),
                 Height = Application.GetRealHeight(32),
                 Text = time,
                 TextColor = 0x00000000,
@@ -513,29 +493,44 @@
         public void ChangeTime(string newTime)
         {
             int.TryParse(newTime, out leftTime);
-            leftTime *= 60;
+            if (leftTime > 0)
+            {
+                Application.RunOnMainThread(() =>
+                {
+                    btnTime.Text = new TimeSpan(0, leftTime, 0).ToString().Remove(5, 3);
+                });
+                leftTime--;
+            }
+            else if (leftTime == 0)
+            {
+                Application.RunOnMainThread(() =>
+                {
+                    btnTime.Text = "";
+                });
+            }
             if (countdownThread == null)
             {
                 countdownThread = new System.Threading.Thread(() =>
                 {
+
                     while (true)
                     {
-                        if (leftTime > 1)
+                        if (leftTime > 0)
                         {
                             Application.RunOnMainThread(() =>
                             {
-                                btnTime.Text = new TimeSpan(0, 0, leftTime).ToString();
+                                btnTime.Text = new TimeSpan(0, leftTime, 0).ToString().Remove(5,3) ;
                             });
-                            System.Threading.Thread.Sleep(1000);
                             leftTime--;
                         }
-                        else
+                        else if(leftTime == 0)
                         {
                             Application.RunOnMainThread(() =>
                             {
                                 btnTime.Text = "";
                             });
                         }
+                        System.Threading.Thread.Sleep(60000);
                     }
                 })
                 { IsBackground = true };

--
Gitblit v1.8.0