From 9a4b76398009cf76c508d61f7e48fb6f5cb7ac2d Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期二, 21 七月 2020 09:46:53 +0800
Subject: [PATCH] 请合并最新多功能面板代码

---
 ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/MutilfunctionPanelMethod.cs |   51 +++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 39 insertions(+), 12 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/MutilfunctionPanelMethod.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/MutilfunctionPanelMethod.cs
index 45cc199..7e5db3d 100644
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/MutilfunctionPanelMethod.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/MutilfunctionPanelMethod.cs
@@ -48,20 +48,41 @@
             var tempList = new List<BindListAllInfo>();
             int count1 = 0;
             int count2 = 0;
+
+            switch (curBindType)
+            {
+                case 1:
+                    curSwitchCount = 0;
+                    break;
+                case 2:
+                    curSocketCount = 0;
+                    break;
+                case 3:
+                    curLightFromRelayCount = 0;
+                    curLightCount = 0;
+                    break;
+            }
+
             foreach (var key in bindTargetsFromMutilfunctionPanelList.Keys)
             {
                 var bList = bindTargetsFromMutilfunctionPanelList[key];
                 foreach (var bDev in bList)
                 {
+                    if (curBindType == 0)
+                    {
+                        if (bDev.KeyEpoint >= 32 && bDev.KeyEpoint <= 51)
+                        {
+                            tempList.Add(bDev);
+                        }
+                    }
+
                     var device = LocalDevice.Current.GetDevice(bDev.BindMacAddr, bDev.BindEpoint);
+                    if (device == null)
+                    {
+                        continue;
+                    }
                     switch (curBindType)
                     {
-                        case 0:
-                            if (bDev.KeyEpoint >= 32 && bDev.KeyEpoint <= 51)
-                            {
-                                tempList.Add(bDev);
-                            }
-                            break;
                         case 1:
                             if (bDev.KeyEpoint >= 52 && bDev.KeyEpoint <= 61)
                             {
@@ -221,15 +242,21 @@
                 var bList = bindTargetsFromMutilfunctionPanelList[key];
                 foreach (var bDev in bList)
                 {
+                    if (curBindType == 0)
+                    {
+                        if (bDev.KeyEpoint >= 32 && bDev.KeyEpoint <= 51)
+                        {
+                            tempList.Remove(bDev.KeyEpoint);
+                        }
+                    }
+
                     var device = LocalDevice.Current.GetDevice(bDev.BindMacAddr, bDev.BindEpoint);
+                    if (device == null)
+                    {
+                        continue;
+                    }
                     switch (curBindType)
                     {
-                        case 0:
-                            if (bDev.KeyEpoint >= 32 && bDev.KeyEpoint <= 51)
-                            {
-                                tempList.Remove(bDev.KeyEpoint);
-                            }
-                            break;
                         case 1:
                         case 2:
                             if (bDev.KeyEpoint >= 52 && bDev.KeyEpoint <= 61)

--
Gitblit v1.8.0