From 48ba446936b51fffafa7c3600c0dadc6ac0e8c20 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期五, 10 七月 2020 10:52:13 +0800
Subject: [PATCH] 2020-07-10-01

---
 ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/BindInfo.cs |  174 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 170 insertions(+), 4 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/BindInfo.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/BindInfo.cs
index 4977f95..9524092 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/BindInfo.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/BindInfo.cs
@@ -2,7 +2,6 @@
 using System.Collections.Generic;
 using System.Threading.Tasks;
 using Shared.Common;
-using Shared.Phone.Device.Category;
 using Shared.Phone.UserCenter.Device;
 using ZigBee.Device;
 using static ZigBee.Device.Panel;
@@ -15,6 +14,176 @@
         /// 褰撳墠鎸夐敭閰嶇疆鐨勫姛鑳�
         /// </summary>
         public static int clusterID = 0;
+        /// <summary>
+        /// 璁板綍鏃х殑鐩爣鍒楄〃
+        /// </summary>
+        public static List<CommonDevice> oldTargetList = new List<CommonDevice>();
+
+        /// <summary>
+        /// 妫�娴嬭璁惧鑳藉惁鏄剧ず
+        /// </summary>
+        /// <param name="device"></param>
+        /// <returns></returns>
+        public static bool CheckCanShowDevice(ZigBee.Device.CommonDevice device, string curDeviceBindType = "AddSwitch")
+        {
+            if (device == null)
+            {
+                return false;
+            }
+            //濡傛灉鏄紶鎰熷櫒锛屾垨鑰呮槸娌℃湁寮�鍏崇皣鐨勮瘽(杩欓噷鍒ゆ柇鐨勬槸杈撳叆绨�)
+            if ((device.Type == ZigBee.Device.DeviceType.IASZone) || InMatchDevice(device, curDeviceBindType) == false)
+            {
+                return false;
+            }
+            return true;
+        }
+
+        /// <summary>
+        /// 妫�娴嬭鎴块棿鑳藉惁鏄剧ず
+        /// </summary>
+        /// <param name="room"></param>
+        /// <returns></returns>
+        public static bool CheckCanShowRoom(Common.Room room, string curDeviceBindType = "AddSwitch")
+        {
+            if (room.ListDevice.Count == 0)
+            {
+                return false;
+            }
+            if (room.IsLove == true)
+            {
+                return false;
+            }
+            foreach (var deviceKeys in room.ListDevice)
+            {
+                var device = Common.LocalDevice.Current.GetDevice(deviceKeys);
+                //妫�娴嬭璁惧鑳藉惁鏄剧ず
+                if (CheckCanShowDevice(device, curDeviceBindType) == false)
+                {
+                    continue;
+                }
+
+                //瀛樺湪璁惧鐨勮瘽锛屾鎴块棿鍙互鏄剧ず
+                return true;
+            }
+            return false;
+        }
+
+        /// <summary>
+        /// 妫�娴嬭澶囨槸鍚︽嫢鏈夊紑鍏崇殑鍔熻兘(杈撳叆绨�)
+        /// </summary>
+        /// <param name="device"></param>
+        /// <returns></returns>
+        public static bool InMatchDevice(CommonDevice device, string curDeviceBindType = "AddSwitch")
+        {
+            foreach (var data in device.InClusterList)
+            {
+                switch (curDeviceBindType)
+                {
+                    case "AddSwitch":
+                        //鎷ユ湁on/off鍔熻兘鐨勶紝鎵嶆敮鎸佹祴璇�
+                        if (data.InCluster == 6)
+                        {
+                            return true;
+                        }
+                        break;
+                    case "AddDimmer":
+                        if (data.InCluster == 8)
+                        {
+                            return true;
+                        }
+                        break;
+                    case "AddCurtain":
+                        if (data.InCluster == 258)
+                        {
+                            return true;
+                        }
+                        break;
+                }
+            }
+            return false;
+        }
+
+        /// <summary>
+        /// 搴曢儴瀹屾垚鎸夐挳鏄剧ず
+        /// </summary>
+        /// <returns></returns>
+        public static void FinishDisplay(List<Room> roomTempList, Button btnFinish)
+        {
+            if (roomTempList.Count == 0)
+            {
+                btnFinish.Enable = false;
+                btnFinish.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect;
+            }
+            else
+            {
+                btnFinish.Enable = true;
+                btnFinish.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
+            }
+        }
+
+        /// <summary>
+        /// 鑾峰彇褰撳墠妤煎眰鍚嶇О
+        /// </summary>
+        /// <returns></returns>
+        public static string GetCurrentKeyAllRoomList()
+        {
+            var dicFloor = HdlRoomLogic.Current.GetFloorSortList();
+            foreach (var floorId in dicFloor.Keys)
+            {
+                //绗竴涓ゼ灞�
+                return dicFloor[floorId];
+            }
+            return null;
+        }
+
+        /// <summary>
+        /// 鑾峰彇褰撳墠妤煎眰
+        /// </summary>
+        /// <returns></returns>
+        public static string GetCurrentSelectFloorId()
+        {
+            var dicFloor = HdlRoomLogic.Current.GetFloorSortList();//
+            foreach (var floorId in dicFloor.Keys)
+            {
+                //绗竴涓ゼ灞�
+                return floorId;
+            }
+            return null;
+        }
+
+        /// <summary>
+        /// 鑾峰彇褰撳墠妤煎眰鍚嶇О
+        /// </summary>
+        /// <returns></returns>
+        public static string GetCurrentSelectFloorIdName()
+        {
+            var dicFloor = HdlRoomLogic.Current.GetFloorSortList();
+            foreach (var floorId in dicFloor.Keys)
+            {
+                //绗竴涓ゼ灞�
+                return dicFloor[floorId];
+            }
+            return null;
+        }
+
+        /// <summary>
+        /// 鑾峰彇褰撳墠妤煎眰鍚嶇О
+        /// fllodID:妤煎眰ID
+        /// </summary>
+        /// <returns></returns>
+        public static string GetBindTargetsFloorIdName(string curFllodID)
+        {
+            var dicFloor = HdlRoomLogic.Current.GetFloorSortList();
+            foreach (var floorId in dicFloor.Keys)
+            {
+                //褰撳墠妤煎眰
+                if (curFllodID == floorId)
+                {
+                    return dicFloor[floorId];
+                }
+            }
+            return null;
+        }
 
         /// <summary>
         ///  妫�娴嬫帶鍒堕潰鏉�(鎸夐敭绫�)鎵�鎷ユ湁鐨勫姛鑳�,鐜版敮鎸佺殑鏈変互涓嬪嚑绉�(蹇呭畾瀛樺湪閿��,鍑洪敊浼氳繑鍥瀗ull)
@@ -223,10 +392,7 @@
                     }
                 }
             }
-
             return dicCheck;
         }
-
-
     }
 }

--
Gitblit v1.8.0