From e747e6d8524e3146bb48dc304a713f309966b1c6 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期二, 19 五月 2020 13:10:03 +0800
Subject: [PATCH] 新版本

---
 ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceCard/Base/DeviceCardCommon.cs |   30 +++++++++++++++++++++---------
 1 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceCard/Base/DeviceCardCommon.cs b/ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceCard/Base/DeviceCardCommon.cs
index e40e221..e966a0b 100755
--- a/ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceCard/Base/DeviceCardCommon.cs
+++ b/ZigbeeApp/Shared/Phone/MainPage/Controls/DeviceCard/Base/DeviceCardCommon.cs
@@ -9,7 +9,7 @@
     /// <summary>
     /// 涓婚〉鐨勮澶囧崱鐗囨帶浠跺簳灞傚叡閫�(瀹藉害:458 + 14 * 2 楂樺害:305 + 43)
     /// </summary>
-    public class DeviceCardCommon : FrameLayoutControl
+    public class DeviceCardCommon : FrameLayoutStatuControl
     {
         #region 鈻� 鍙橀噺澹版槑___________________________
 
@@ -57,6 +57,10 @@
         /// 鍒ゆ柇鏄惁鏈夊紑鍏冲姛鑳�
         /// </summary>
         private bool isHadOpenSwitch = true;
+        /// <summary>
+        /// 褰撳墠閫夋嫨鐨勬埧闂�
+        /// </summary>
+        public Common.Room nowSelectRoom = null;
 
         #endregion
 
@@ -79,9 +83,11 @@
         /// 鍒濆鍖栨帶浠�
         /// </summary>
         /// <param name="i_device">鎸囧畾璁惧</param>
-        public virtual void InitControl(CommonDevice i_device)
+        /// <param name="i_nowSelectRoom">褰撳墠閫夋嫨鐨勬埧闂�(鏈夌偣鐢ㄥ)</param>
+        public virtual void InitControl(CommonDevice i_device, Common.Room i_nowSelectRoom)
         {
             this.device = i_device;
+            this.nowSelectRoom = i_nowSelectRoom;
             //鑳屾櫙鍥剧墖
             this.btnBackGroud = new PicViewControl(this.Width, this.Height, false);
             btnBackGroud.UnSelectedImagePath = "Item/FunctionCardView.png";
@@ -115,7 +121,7 @@
                 {
                     //鍙栨秷鏀惰棌
                     HdlRoomLogic.Current.DeleteLoveDevice(i_device);
-                    if (HdlRoomLogic.Current.CurrentRoom.IsLove == true)
+                    if (this.nowSelectRoom.IsLove == true)
                     {
                         //濡傛灉褰撳墠鎴块棿鏄垜鐨勫枩鐖辩殑璇�,鍥炶皟鍗$墖琚垹闄ょ殑浜嬩欢
                         this.CardNeedRemoveEvent?.Invoke();
@@ -145,7 +151,7 @@
             this.ChangedChidrenBindMode(fraDeviceRound, ChidrenBindMode.BindEventOnly);
 
             //鐘舵�佹枃鏈帶浠�
-            this.btnStatu = new NormalViewControl(HdlControlLogic.Current.GetPictrueRealSize(280), HdlControlLogic.Current.GetPictrueRealSize(63), false);
+            this.btnStatu = new NormalViewControl(HdlControlLogic.Current.GetPictrueRealSize(300), HdlControlLogic.Current.GetPictrueRealSize(63), false);
             btnStatu.X = HdlControlLogic.Current.GetPictrueRealSize(46);
             btnStatu.Y = HdlControlLogic.Current.GetPictrueRealSize(236);
             btnStatu.TextColor = UserCenterColor.Current.TextColor1;
@@ -195,6 +201,8 @@
             }
             //璁惧鍥炬爣涔熷埛鏂�
             Common.LocalDevice.Current.SetDeviceIconToControl2(btnDeviceIcon, i_device);
+            //鍚嶅瓧鍒锋柊
+            this.btnDeviceName.Text = Common.LocalDevice.Current.GetDeviceEpointName(i_device);
             //妫�娴嬭澶囨槸鍚︽槸鎵撳紑鐘舵��
             bool isOpen = this.CheckIsOpenStatu(i_device);
             if (this.isHadOpenSwitch == true && i_device.HadReadDeviceStatu == false)
@@ -294,7 +302,7 @@
             //濡傛灉杩欎釜鍑芥暟琚噸鍐欑殑璇�,鍒欎唬琛ㄨ繖涓澶囨湁寮�鍏冲姛鑳�
             this.isHadOpenSwitch = false;
             //榛樿鐢ㄥ湪绾跨姸鎬佹潵鍒ゆ柇
-            return i_device.IsOnline == 1;
+            return Common.LocalDevice.Current.CheckDeviceIsOnline(i_device);
         }
 
 
@@ -306,10 +314,9 @@
         /// 娣卞害鍗$墖淇℃伅鐨勮繑鍥炰簨浠�(搴曞眰涓撶敤)
         /// </summary>
         /// <param name="device">璁惧</param>
-        /// <param name="room">鎴块棿</param>
-        public void CardDetailInfoBackEvent(CommonDevice device, Common.Room room)
+        public void CardDetailInfoBackEvent(CommonDevice device)
         {
-            if (HdlRoomLogic.Current.CurrentRoom.IsLove == true)
+            if (this.nowSelectRoom.IsLove == true)
             {
                 //濡傛灉鏄富椤靛彇娑堟悳钘忕殑璇�,鍥炶皟鍗$墖琚垹闄ょ殑鍑芥暟
                 if (HdlRoomLogic.Current.IsCollectInRoom(device) == false)
@@ -322,7 +329,7 @@
             {
                 //濡傛灉杩欎釜璁惧鏀瑰彉浜嗘埧闂寸殑璇�,鍥炶皟鍗$墖琚垹闄ょ殑鍑芥暟
                 var nowRoom = HdlRoomLogic.Current.GetRoomByDevice(device);
-                if (nowRoom == null || nowRoom.Id != HdlRoomLogic.Current.CurrentRoom.Id)
+                if (nowRoom == null || nowRoom.Id != this.nowSelectRoom.Id)
                 {
                     this.CardNeedRemoveEvent?.Invoke();
                     return;
@@ -343,6 +350,11 @@
         /// <param name="oldOpenStatu">璁惧鐩墠鐨勫紑鍏崇姸鎬�</param>
         public void StartCheckResponeResult(bool oldOpenStatu)
         {
+            if (Common.Config.Instance.Home.IsVirtually == true)
+            {
+                //濡傛灉浣忓畢涓鸿櫄鎷熶綇瀹�,鍒欐鍔熻兘鏃犳晥
+                return;
+            }
             this.ResponeResult = 0;
             //寮�鍏虫寜閽笉鑳藉啀鐐瑰嚮
             if (btnSwitch != null) { this.btnSwitch.CanClick = false; }

--
Gitblit v1.8.0