From dfcb2a1844fd55b57bae23e290b30ec6380e8508 Mon Sep 17 00:00:00 2001
From: chenqiyang <1406175257@qq.com>
Date: 星期五, 26 八月 2022 15:04:22 +0800
Subject: [PATCH] 更新全视通dll

---
 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceObjectControl.cs |  396 +++++++++++++++++++++++++++++++-------------------------
 1 files changed, 220 insertions(+), 176 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceObjectControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceObjectControl.cs
old mode 100755
new mode 100644
index 850137d..58dffb7
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceObjectControl.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceObjectControl.cs
@@ -1,177 +1,221 @@
-锘縰sing System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace Shared.Phone.UserCenter
-{
-    /// <summary>
-    /// 鍋氭垚涓�涓樉绀鸿澶囩被鍨�+璁惧MAC澶囨敞鐨凴owLayout
-    /// </summary>
-    public class DeviceObjectControl : RowLayoutControl
-    {
-        #region 鈻� 鍙橀噺澹版槑___________________________
-
-        /// <summary>
-        /// 璁惧鐨凪ac鍦板潃
-        /// </summary>
-        public string deviceMac = string.Empty;
-        /// <summary>
-        /// 鍙細鍒锋柊涓�娆�
-        /// </summary>
-        private bool hadRefresh = false;
-        /// <summary>
-        /// 鍦ㄧ嚎鐘舵��
-        /// </summary>
-        private bool m_isOnline = false;
-        /// <summary>
-        /// 浼犳劅鍣ㄦ帹閫佷腑
-        /// </summary>
-        private bool sensorPushing = false;
-        /// <summary>
-        /// 鍦ㄧ嚎鐘舵��
-        /// </summary>
-        public bool isOnline
-        {
-            get { return m_isOnline; }
-            set
-            {
-                m_isOnline = value;
-                //璁剧疆鍦ㄧ嚎鐘舵�佺殑鐗规晥
-                this.SetOnlineStatu(m_isOnline);
-            }
-        }
-
-        /// <summary>
-        /// 鍥炬爣鎺т欢
-        /// </summary>
-        public IconViewControl btnIcon = null;
-        /// <summary>
-        /// 璁惧澶囨敞鎺т欢
-        /// </summary>
-        private NormalViewControl btnDeviceName = null;
-        /// <summary>
-        /// 璁惧鎴块棿鎺т欢
-        /// </summary>
-        private NormalViewControl btnDeviceRoom = null;
-
-        #endregion
-
-        #region 鈻� 鍒濆鍖朹____________________________
-
-        /// <summary>
-        /// 鍋氭垚涓�涓樉绀鸿澶囩被鍨�+璁惧MAC澶囨敞鐨凴owLayout
-        /// </summary>
-        /// <param name="i_deviceMac">璁惧鐨凪ac鍦板潃</param>
-        /// <param name="i_ChidrenYaxis">瀛愭帶浠禮杞村亸绉婚噺(鐪熷疄鍊�,鏈変簺鐣岄潰闇�瑕佽繖绉嶇壒娈婃搷浣�)</param>
-        public DeviceObjectControl(string i_deviceMac, int i_ChidrenYaxis = 0) : base(i_ChidrenYaxis)
-        {
-            this.deviceMac = i_deviceMac;
-        }
-
-        /// <summary>
-        /// 鍒濆鍖栧唴閮ㄦ帶浠�
-        /// </summary>
-        public void InitControl()
-        {
-            var listDevice = Common.LocalDevice.Current.GetDevicesByMac(this.deviceMac);
-            //鍥炬爣
-            btnIcon = frameTable.AddLeftIcon(81);
-            Common.LocalDevice.Current.SetDeviceObjectIconToControl(btnIcon, listDevice);
-
-            //璁惧
-            string deviceName = Common.LocalDevice.Current.GetDeviceMacName(listDevice[0]);
-            btnDeviceName = frameTable.AddTopView(deviceName, 800);
-            frameTable.AddChidren(btnDeviceName, ChidrenBindMode.BindEventOnly);
-
-            //鎴块棿
-            string roomName = Common.LocalDevice.Current.GeteRealDeviceRoomName(listDevice[0]);
-            btnDeviceRoom = frameTable.AddBottomView(roomName, 800);
-
-            //搴曠嚎
-            frameTable.AddBottomLine();
-
-            //璁剧疆鍦ㄧ嚎鐘舵�佺殑鐗规晥
-            this.isOnline = listDevice[0].IsOnline == 1;
-        }
-
-        #endregion
-
-        #region 鈻� 涓�鑸柟娉昣__________________________
-
-        /// <summary>
-        /// 璁剧疆鍦ㄧ嚎鐘舵�佺殑鐗规晥
-        /// </summary>
-        /// <param name="isOnline"></param>
-        private void SetOnlineStatu(bool isOnline)
-        {
-            if (isOnline == false)
-            {
-                btnDeviceName.TextColor = UserCenterColor.Current.TextGrayColor1;
+锘縰sing System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Shared.Phone.UserCenter
+{
+    /// <summary>
+    /// 鍋氭垚涓�涓樉绀鸿澶囩被鍨�+璁惧MAC澶囨敞鐨凴owLayout
+    /// </summary>
+    public class DeviceObjectControl : RowLayoutControl
+    {
+        #region 鈻� 鍙橀噺澹版槑___________________________
+
+        /// <summary>
+        /// 璁惧鐨凪ac鍦板潃
+        /// </summary>
+        public string deviceMac = string.Empty;
+        /// <summary>
+        /// 鍙細鍒锋柊涓�娆�
+        /// </summary>
+        private bool hadRefresh = false;
+        /// <summary>
+        /// 浼犳劅鍣ㄦ帹閫佷腑
+        /// </summary>
+        private bool sensorPushing = false;
+        /// <summary>
+        /// 鍦ㄧ嚎鐘舵��
+        /// </summary>
+        private bool m_isOnline = true;
+        /// <summary>
+        /// 鍦ㄧ嚎鐘舵��
+        /// </summary>
+        public bool IsOnline
+        {
+            get { return m_isOnline; }
+            set
+            {
+                if (m_isOnline != value)
+                {
+                    m_isOnline = value;
+                    //璁剧疆鍦ㄧ嚎鐘舵�佺殑鐗规晥
+                    this.SetOnlineStatu(m_isOnline);
+                }
             }
-            else
-            {
-                btnDeviceName.TextColor = UserCenterColor.Current.TextColor1;
-            }
-        }
-
-        /// <summary>
-        /// 鍒锋柊鍏ㄩ儴鏄剧ず淇℃伅
-        /// </summary>
-        /// <param name="compel">鏄惁寮哄埗鎵ц</param>
-        public void RefreshControlInfo(bool compel = false)
-        {
-            if (hadRefresh == true && compel == false)
-            {
-                return;
-            }
-            hadRefresh = true;
-
-            var listDevice = Common.LocalDevice.Current.GetDevicesByMac(this.deviceMac);
-            //鍥炬爣
-            Common.LocalDevice.Current.SetDeviceObjectIconToControl(btnIcon, listDevice);
-            //璁惧
-            btnDeviceName.Text = Common.LocalDevice.Current.GetDeviceMacName(listDevice[0]);
-            //璁惧鎴块棿
-            btnDeviceRoom.Text = Common.LocalDevice.Current.GeteRealDeviceRoomName(listDevice[0]);
-            //璁剧疆鍦ㄧ嚎鐘舵�佺殑鐗规晥
-            this.isOnline = listDevice[0].IsOnline == 1;
-        }
-
-
-        /// <summary>
-        /// 鏄剧ず浼犳劅鍣ㄤ笂鎶ョ殑鐗规晥
-        /// </summary>
-        public void StartSensorPushAppeal()
-        {
-            if (this.sensorPushing == true)
-            {
-                //浼犳劅鍣ㄦ鍦ㄧ壒鏁堜腑
-                return;
-            }
-            this.sensorPushing = true;
-            //璁惧
-            uint oldTextColor1 = btnDeviceName.TextColor;
-            btnDeviceName.TextColor = UserCenterColor.Current.TextOrangeColor;
-            //璁惧鎴块棿
-            uint oldTextColor2 = btnDeviceRoom.TextColor;
-            btnDeviceRoom.TextColor = UserCenterColor.Current.TextOrangeColor;
-            HdlThreadLogic.Current.RunThread(() =>
-            {
-                System.Threading.Thread.Sleep(5000);
-                HdlThreadLogic.Current.RunMain(() =>
-                {
-                    if (btnDeviceName.Parent != null)
-                    {
-                        //璁惧
-                        btnDeviceName.TextColor = oldTextColor1;
-                        //璁惧鎴块棿
-                        btnDeviceRoom.TextColor = oldTextColor2;
-                    }
-                    this.sensorPushing = false;
-                }, ShowErrorMode.NO);
-            });
-        }
-
-        #endregion
-    }
-}
+        }
+
+        /// <summary>
+        /// 鍥炬爣鎺т欢
+        /// </summary>
+        public IconViewControl btnIcon = null;
+        /// <summary>
+        /// 璁惧澶囨敞鎺т欢
+        /// </summary>
+        private NormalViewControl btnDeviceName = null;
+        /// <summary>
+        /// 璁惧鎴块棿鎺т欢
+        /// </summary>
+        private NormalViewControl btnDeviceRoom = null;
+
+        #endregion
+
+        #region 鈻� 鍒濆鍖朹____________________________
+
+        /// <summary>
+        /// 鍋氭垚涓�涓樉绀鸿澶囩被鍨�+璁惧MAC澶囨敞鐨凴owLayout
+        /// </summary>
+        /// <param name="i_deviceMac">璁惧鐨凪ac鍦板潃</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;
+        }
+
+        /// <summary>
+        /// 鍒濆鍖栧唴閮ㄦ帶浠�
+        /// </summary>
+        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.SetDeviceObjectIconToControl(btnIcon, listDevice);
+
+            //璁惧
+            string deviceName = Common.LocalDevice.Current.GetDeviceMacName(listDevice[0]);
+            btnDeviceName = frameTable.AddTopView(deviceName, 800);
+            frameTable.AddChidren(btnDeviceName, ChidrenBindMode.BindEvent);
+
+            //鎴块棿
+            string roomName = HdlRoomLogic.Current.GeteRealDeviceRoomName(listDevice[0]);
+            btnDeviceRoom = frameTable.AddBottomView(roomName, 800);
+
+            //搴曠嚎
+            frameTable.AddBottomLine();
+
+            //璁剧疆鍦ㄧ嚎鐘舵�佺殑鐗规晥
+            this.IsOnline = Common.LocalDevice.Current.CheckDeviceIsOnline(listDevice[0]);
+        }
+
+        #endregion
+
+        #region 鈻� 涓�鑸柟娉昣__________________________
+
+        /// <summary>
+        /// 璁剧疆鍦ㄧ嚎鐘舵�佺殑鐗规晥
+        /// </summary>
+        /// <param name="i_isOnline"></param>
+        private void SetOnlineStatu(bool i_isOnline)
+        {
+            if (i_isOnline == false)
+            {
+                btnDeviceName.TextColor = UserCenterColor.Current.TextGrayColor1;
+            }
+            else
+            {
+                btnDeviceName.TextColor = UserCenterColor.Current.TextColor1;
+            }
+        }
+
+        /// <summary>
+        /// 鍒锋柊鍏ㄩ儴鏄剧ず淇℃伅
+        /// </summary>
+        /// <param name="compel">鏄惁寮哄埗鎵ц</param>
+        public void RefreshControlInfo(bool compel = false)
+        {
+            if (hadRefresh == true && compel == false)
+            {
+                return;
+            }
+            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.SetDeviceObjectIconToControl(btnIcon, listDevice);
+            //璁惧
+            btnDeviceName.Text = Common.LocalDevice.Current.GetDeviceMacName(listDevice[0]);
+            //璁惧鎴块棿
+            btnDeviceRoom.Text = HdlRoomLogic.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