From ade5917841b0fdcb1df7353ef7c56b1a1bdc9282 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期二, 22 九月 2020 10:03:32 +0800
Subject: [PATCH] 删除 Gateway.Ios文件

---
 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceObjectControl.cs |  156 +++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 113 insertions(+), 43 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceObjectControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceObjectControl.cs
index 55c143d..cc6932b 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceObjectControl.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceObjectControl.cs
@@ -20,20 +20,27 @@
         /// </summary>
         private bool hadRefresh = false;
         /// <summary>
-        /// 鍦ㄧ嚎鐘舵��
+        /// 浼犳劅鍣ㄦ帹閫佷腑
         /// </summary>
-        private bool m_isOnline = false;
+        private bool sensorPushing = false;
         /// <summary>
         /// 鍦ㄧ嚎鐘舵��
         /// </summary>
-        public bool isOnline
+        private bool m_isOnline = true;
+        /// <summary>
+        /// 鍦ㄧ嚎鐘舵��
+        /// </summary>
+        public bool IsOnline
         {
             get { return m_isOnline; }
             set
             {
-                m_isOnline = value;
-                //璁剧疆鍦ㄧ嚎鐘舵�佺殑鐗规晥
-                this.SetOnlineStatu(m_isOnline);
+                if (m_isOnline != value)
+                {
+                    m_isOnline = value;
+                    //璁剧疆鍦ㄧ嚎鐘舵�佺殑鐗规晥
+                    this.SetOnlineStatu(m_isOnline);
+                }
             }
         }
 
@@ -42,13 +49,13 @@
         /// </summary>
         public IconViewControl btnIcon = null;
         /// <summary>
-        /// 璁惧绫诲瀷鎺т欢
-        /// </summary>
-        private NormalViewControl btnDeviceObject = null;
-        /// <summary>
         /// 璁惧澶囨敞鎺т欢
         /// </summary>
         private NormalViewControl btnDeviceName = null;
+        /// <summary>
+        /// 璁惧鎴块棿鎺т欢
+        /// </summary>
+        private NormalViewControl btnDeviceRoom = null;
 
         #endregion
 
@@ -58,7 +65,7 @@
         /// 鍋氭垚涓�涓樉绀鸿澶囩被鍨�+璁惧MAC澶囨敞鐨凴owLayout
         /// </summary>
         /// <param name="i_deviceMac">璁惧鐨凪ac鍦板潃</param>
-        /// <param name="i_ChidrenYaxis">瀛愭帶浠禮杞村亸绉婚噺(鐪熷疄鍊�,鏈変簺鐣岄潰闇�瑕佽繖绉嶇壒娈婃搷浣�)</param>
+        /// <param name="i_ChidrenYaxis">瀛愭帶浠禮杞村亸绉婚噺(銆愬垪琛ㄦ帶浠剁殑rowSpace/2銆戝嵆鍙�,涓嶆噦榛樿涓�0鍗冲彲)</param>
         public DeviceObjectControl(string i_deviceMac, int i_ChidrenYaxis = 0) : base(i_ChidrenYaxis)
         {
             this.deviceMac = i_deviceMac;
@@ -70,36 +77,29 @@
         public void InitControl()
         {
             var listDevice = Common.LocalDevice.Current.GetDevicesByMac(this.deviceMac);
+            if (listDevice.Count == 0)
+            {
+                //閽堝鍗曠函鍙湁涓�涓�200绔偣鐨勮澶�
+                listDevice.Add(Common.LocalDevice.Current.GetOTADevice(this.deviceMac));
+            }
             //鍥炬爣
             btnIcon = frameTable.AddLeftIcon(81);
-            Common.LocalDevice.Current.SetDeviceBeloneIconToControl(btnIcon, listDevice);
-
-            //璁惧绫诲瀷
-            string objText = Common.LocalDevice.Current.GetDeviceObjectText(listDevice);
-            btnDeviceObject = frameTable.AddLeftCaption(objText, 800, 60, true);
-            btnDeviceObject.TextSize = 15;
-            //杩欎釜鍧愭爣鏈夌偣鐗规畩
-            btnDeviceObject.Y = Application.GetRealHeight(12) + this.chidrenYaxis;
-            btnDeviceObject.Text = Common.LocalDevice.Current.GetDeviceObjectText(listDevice);
-            frameTable.AddChidren(btnDeviceObject, ChidrenBindMode.BindEventOnly);
+            Common.LocalDevice.Current.SetDeviceObjectIconToControl(btnIcon, listDevice);
 
             //璁惧
             string deviceName = Common.LocalDevice.Current.GetDeviceMacName(listDevice[0]);
-            btnDeviceName = frameTable.AddLeftCaption(deviceName, 800, 49, true);
-            //杩欎釜鍧愭爣鏈夌偣鐗规畩
-            btnDeviceName.Y = Application.GetRealHeight(72) + this.chidrenYaxis;
-            btnDeviceName.TextSize = 12;
-            btnDeviceName.TextColor = UserCenterColor.Current.TextGrayColor1;
-            btnDeviceName.Text = Common.LocalDevice.Current.GetDeviceMacName(listDevice[0]);
-            frameTable.AddChidren(btnDeviceName, ChidrenBindMode.BindEventOnly);
+            btnDeviceName = frameTable.AddTopView(deviceName, 800);
+            frameTable.AddChidren(btnDeviceName, ChidrenBindMode.BindEvent);
+
+            //鎴块棿
+            string roomName = Common.LocalDevice.Current.GeteRealDeviceRoomName(listDevice[0]);
+            btnDeviceRoom = frameTable.AddBottomView(roomName, 800);
 
             //搴曠嚎
             frameTable.AddBottomLine();
 
             //璁剧疆鍦ㄧ嚎鐘舵�佺殑鐗规晥
-            this.isOnline = listDevice[0].IsOnline == 1;
-
-            listDevice = null;
+            this.IsOnline = Common.LocalDevice.Current.CheckDeviceIsOnline(listDevice[0]);
         }
 
         #endregion
@@ -109,16 +109,16 @@
         /// <summary>
         /// 璁剧疆鍦ㄧ嚎鐘舵�佺殑鐗规晥
         /// </summary>
-        /// <param name="isOnline"></param>
-        private void SetOnlineStatu(bool isOnline)
+        /// <param name="i_isOnline"></param>
+        private void SetOnlineStatu(bool i_isOnline)
         {
-            if (isOnline == false)
+            if (i_isOnline == false)
             {
-                btnDeviceObject.TextColor = UserCenterColor.Current.TextGrayColor1;
+                btnDeviceName.TextColor = UserCenterColor.Current.TextGrayColor1;
             }
             else
             {
-                btnDeviceObject.TextColor = UserCenterColor.Current.TextColor1;
+                btnDeviceName.TextColor = UserCenterColor.Current.TextColor1;
             }
         }
 
@@ -135,17 +135,87 @@
             hadRefresh = true;
 
             var listDevice = Common.LocalDevice.Current.GetDevicesByMac(this.deviceMac);
+            if (listDevice.Count == 0)
+            {
+                //閽堝鍗曠函鍙湁涓�涓�200绔偣鐨勮澶�
+                listDevice.Add(Common.LocalDevice.Current.GetOTADevice(this.deviceMac));
+            }
             //鍥炬爣
-            Common.LocalDevice.Current.SetDeviceBeloneIconToControl(btnIcon, listDevice);
-            //璁惧绫诲瀷
-            btnDeviceObject.Text = Common.LocalDevice.Current.GetDeviceObjectText(listDevice);
+            Common.LocalDevice.Current.SetDeviceObjectIconToControl(btnIcon, listDevice);
             //璁惧
             btnDeviceName.Text = Common.LocalDevice.Current.GetDeviceMacName(listDevice[0]);
-            //璁剧疆鍦ㄧ嚎鐘舵�佺殑鐗规晥
-            this.isOnline = listDevice[0].IsOnline == 1;
-
-            listDevice = null;
+            //璁惧鎴块棿
+            btnDeviceRoom.Text = Common.LocalDevice.Current.GeteRealDeviceRoomName(listDevice[0]);
         }
+
+
+        /// <summary>
+        /// 鏄剧ず浼犳劅鍣ㄤ笂鎶ョ殑鐗规晥
+        /// </summary>
+        public void StartSensorPushAppeal()
+        {
+            if (this.sensorPushing == true)
+            {
+                //浼犳劅鍣ㄦ鍦ㄧ壒鏁堜腑
+                return;
+            }
+            this.sensorPushing = true;
+
+            HdlThreadLogic.Current.RunThread(() =>
+            {
+                //闂儊5绉�,闂撮殧400姣
+                int count = 5000 / 400;
+                bool isOpen = false;
+                while (this.Parent != null && count >= 0)
+                {
+                    //闂儊鐗规晥
+                    HdlThreadLogic.Current.RunMain(() =>
+                    {
+                        isOpen = !isOpen;
+                        this.SwitchRowStatuAppeal(isOpen);
+                    }, ShowErrorMode.NO);
+                    System.Threading.Thread.Sleep(400);
+                    count--;
+                }
+                if (this.Parent != null && isOpen == true)
+                {
+                    HdlThreadLogic.Current.RunMain(() =>
+                    {
+                        //缁撴潫鏃�,榛樿涓烘棤鐗规晥
+                        this.SwitchRowStatuAppeal(false);
+                    }, ShowErrorMode.NO);
+                }
+                this.sensorPushing = false;
+
+            }, ShowErrorMode.NO);
+        }
+
+        /// <summary>
+        /// 鍒囨崲琛岄棯鐑佺壒鏁�
+        /// </summary>
+        /// <param name="isOpen"></param>
+        private void SwitchRowStatuAppeal(bool isOpen)
+        {
+            if (isOpen == true)
+            {
+                //鍥炬爣
+                btnIcon.IsSelected = true;
+                //璁惧
+                btnDeviceName.TextColor = UserCenterColor.Current.TextOrangeColor;
+                //璁惧鎴块棿
+                btnDeviceRoom.TextColor = UserCenterColor.Current.TextOrangeColor;
+            }
+            else
+            {
+                //鍥炬爣
+                btnIcon.IsSelected = false;
+                //璁惧
+                btnDeviceName.TextColor = UserCenterColor.Current.TextColor1;
+                //璁惧鎴块棿
+                btnDeviceRoom.TextColor = UserCenterColor.Current.TextGrayColor1;
+            }
+        }
+
         #endregion
     }
 }

--
Gitblit v1.8.0