From 412e0af11df2b1d7986adf002e7997d82344ab3e Mon Sep 17 00:00:00 2001 From: xm <1271024303@qq.com> Date: 星期一, 13 七月 2020 09:47:40 +0800 Subject: [PATCH] 请合并最新版代码 --- ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/PaneTargetsBaseForm.cs | 230 ++++++++++++++++++++++---------------------------------- 1 files changed, 91 insertions(+), 139 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/PaneTargetsBaseForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/PaneTargetsBaseForm.cs index 8595209..7fdf549 100644 --- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/PaneTargetsBaseForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/PaneTargetsBaseForm.cs @@ -732,7 +732,7 @@ }); } - targetList.Clear(); + oldTargetList.Clear(); //閫変腑鐩爣鍒楄〃 targetList if (curControlDev.bindList.Count != 0) { @@ -901,50 +901,18 @@ Application.RunOnMainThread(() => { CommonPage.Loading.Start(""); }); if (btnTipPic.IsSelected) { - //缁戝畾绌虹洰鏍囧繀椤诲彇娑堟寜閿腑宸茬粡瀛樺湪鐨勭洰鏍� + //鍒犻櫎鎯呭喌1:缁戝畾绌虹洰鏍囧繀椤诲彇娑堟寜閿腑宸茬粡瀛樺湪鐨勭洰鏍� if (oldTargetList.Count != 0) { - //鍒犻櫎鍙栨秷鐨勭洰鏍� + //鍒犻櫎鎸夐敭涓凡缁忕粦瀹氱殑鐩爣涓暟銆愬垹闄ゆ垚鍔熶釜鏁般�� + int sOldTargetListCount = 0; + foreach (var bd in oldTargetList) { - var delDevice = new DelDeviceBindData(); - delDevice.DeviceAddr = curControlDev.DeviceAddr; - delDevice.Epoint = curControlDev.DeviceEpoint; + var delDevice = DelBindDevice(bd); - var removeDevice = new RemoveBindListObj(); - removeDevice.BindType = 0; - switch (curDeviceBindType) - { - case BindInfo.BindType.FreshAir: - removeDevice.BindCluster = 514; - break; - case BindInfo.BindType.Temperature: - removeDevice.BindCluster = 1026; - break; - case BindInfo.BindType.Humidity: - removeDevice.BindCluster = 1029; - break; - case BindInfo.BindType.PM: - removeDevice.BindCluster = 1066; - break; - case BindInfo.BindType.AC: - removeDevice.BindCluster = 513;//Ac闇�瑕佺粦瀹�2涓皣513鍜�514 - break; - } - removeDevice.BindMacAddr = bd.DeviceAddr; - removeDevice.BindEpoint = bd.DeviceEpoint; - delDevice.RemoveBindList.Add(removeDevice); - - if (curDeviceBindType == BindInfo.BindType.AC) - { - //瑕佺Щ闄ょ┖璋冿細闇�瑕佺Щ闄�513锛�514 - var removeDevice3 = new RemoveBindListObj(); - removeDevice3.BindCluster = 514; - removeDevice3.BindType = 0; - removeDevice3.BindMacAddr = bd.DeviceAddr; - removeDevice3.BindEpoint = bd.DeviceEpoint; - delDevice.RemoveBindList.Add(removeDevice3); - } + //姝ゆ鎸夐敭涓渶瑕佺Щ闄ょ殑鐩爣涓暟銆愬悓涓�涓洰鏍囨惡甯︾殑澶氫釜鍔熻兘鍒犻櫎鎴愬姛鐨勪釜鏁般�� + int sRemoveBindListCount = 0; var delResult = new DelDeviceBindResponseAllData(); delResult = HdlDeviceBindLogic.Current.DelDeviceBindAsync(delDevice); @@ -977,14 +945,24 @@ { if (d.Result == 0 || d.Result == 1) { - TargesBindName(); - Application.RunOnMainThread(() => + sRemoveBindListCount++; + if (sRemoveBindListCount == delDevice.RemoveBindList.Count) { - CommonPage.Loading.Hide(); - btnFinifh.Enable = true; - btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; - this.RemoveFromParent(); - }); + sOldTargetListCount++; + } + + //鎸夐敭鐩爣涓殑璇ョ被鍨嬩釜鏁伴兘鍒犻櫎鎴愬姛 + if (sOldTargetListCount == oldTargetList.Count) + { + TargesBindName(); + Application.RunOnMainThread(() => + { + CommonPage.Loading.Hide(); + btnFinifh.Enable = true; + btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; + this.RemoveFromParent(); + }); + } } else { @@ -1004,14 +982,19 @@ { if (delResult.removeBindResultResponseData.Result == 0) { - TargesBindName(); - Application.RunOnMainThread(() => + sOldTargetListCount++; + //鎸夐敭鐩爣涓殑璇ョ被鍨嬩釜鏁伴兘鍒犻櫎鎴愬姛 + if (sOldTargetListCount == oldTargetList.Count) { - CommonPage.Loading.Hide(); - btnFinifh.Enable = true; - btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; - this.RemoveFromParent(); - }); + TargesBindName(); + Application.RunOnMainThread(() => + { + CommonPage.Loading.Hide(); + btnFinifh.Enable = true; + btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; + this.RemoveFromParent(); + }); + } } else { @@ -1080,11 +1063,17 @@ { Application.RunOnMainThread(() => { CommonPage.Loading.Start(""); }); - //鍒犻櫎鎸夐敭宸茬粡瀛樺湪鐨勭洰鏍� + //鍒犻櫎鎯呭喌2:鎸夐敭涔嬪墠宸茬粡瀛樺湪鐨勭洰鏍� if (oldTargetList.Count != 0) { + //鍒犻櫎鎸夐敭涓凡缁忕粦瀹氱殑鐩爣涓暟銆愬垹闄ゆ垚鍔熶釜鏁般�� + int sOldTargetListCount = 0; + foreach (var bd in oldTargetList) { + //姝ゆ鎸夐敭涓渶瑕佺Щ闄ょ殑鐩爣涓暟銆愬悓涓�涓洰鏍囨惡甯︾殑澶氫釜鍔熻兘鍒犻櫎鎴愬姛鐨勪釜鏁般�� + int sRemoveBindListCount = 0; + var delDevice = DelBindDevice(bd); var delResult = new DelDeviceBindResponseAllData(); delResult = HdlDeviceBindLogic.Current.DelDeviceBindAsync(delDevice); @@ -1127,91 +1116,43 @@ }); return; } - } - } - } - } - if (delResult != null && delResult.removeBindResultResponseData != null) - { - if (delResult.removeBindResultResponseData.Result != 0) - { - Application.RunOnMainThread(() => - { - new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFailed), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance); - btnFinifh.Enable = true; - btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; - CommonPage.Loading.Hide(); - }); - return; - } - } - } - } - else - { - //妫�娴嬪凡缁忕粦瀹氱殑鐩爣鏄惁涓嶅湪鏈湴锛屼絾鏄寜閿腑鏈夎鐩爣锛屾鏃堕渶瑕佸垹闄ゅ凡缁忚缁戝畾鍒扮洰鏍囷紝鎵嶈兘缁х画缁戝畾鏂扮洰鏍囥�備互闃蹭竴涓寜閿粦瀹氬涓浉鍚岀被鍨嬬殑鐩爣 - if (curBindDevice != null) - { - var delDevice = DelBindDevice(curBindDevice); - var delResult = new DelDeviceBindResponseAllData(); - delResult = HdlDeviceBindLogic.Current.DelDeviceBindAsync(delDevice); - if (delResult == null) - { - Application.RunOnMainThread(() => - { - new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFailed), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance); - CommonPage.Loading.Hide(); - - ShowReLoadView(); - ReLoadAction += () => - { - this.midFrameLayout.RemoveAll(); - //鍒濆鍖栬澶囨暟鎹� - CommonPage.Loading.Start(""); - MidFrameLayoutContent(); - InitData(true); - }; - }); - return; - } - else - { - if (delResult.removeBindResultResponseData == null) - { - if (delResult.delDeviceBindResponseData != null) - { - foreach (var d in delResult.delDeviceBindResponseData.RemoveBindList) - { - if (d.Result != 0 && d.Result != 1) + sRemoveBindListCount++; + if (sRemoveBindListCount == delDevice.RemoveBindList.Count) { - Application.RunOnMainThread(() => - { - new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFailed), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance); - btnFinifh.Enable = true; - btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; - CommonPage.Loading.Hide(); - }); - return; + sOldTargetListCount++; } } } } - } - if (delResult != null && delResult.removeBindResultResponseData != null) - { - if (delResult.removeBindResultResponseData.Result != 0) + else { - Application.RunOnMainThread(() => + if (delResult.removeBindResultResponseData.Result != 0) { - new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFailed), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance); - btnFinifh.Enable = true; - btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; - CommonPage.Loading.Hide(); - }); - return; + Application.RunOnMainThread(() => + { + new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFailed), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance); + btnFinifh.Enable = true; + btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; + CommonPage.Loading.Hide(); + }); + return; + } + sOldTargetListCount++; } } + } + + if (sOldTargetListCount != oldTargetList.Count) + { + Application.RunOnMainThread(() => + { + new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFailed), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance); + btnFinifh.Enable = true; + btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; + CommonPage.Loading.Hide(); + }); + return; } } @@ -1460,7 +1401,6 @@ { if (device.Type == DeviceType.FreshAir) { - targetList.Add(device); oldTargetList.Add(device); } } @@ -1471,7 +1411,6 @@ var bDev = device as TemperatureSensor; if (bDev.SensorDiv == 1) { - targetList.Add(device); oldTargetList.Add(device); } } @@ -1479,7 +1418,6 @@ { if (bindDev.BindCluster == 1026) { - targetList.Add(device); oldTargetList.Add(device); } } @@ -1490,20 +1428,17 @@ var bDev = device as TemperatureSensor; if (bDev.SensorDiv == 2) { - targetList.Add(device); oldTargetList.Add(device); } } if (device.Type == DeviceType.FreshAirHumiditySensor) { - targetList.Add(device); oldTargetList.Add(device); } if (device.Type == DeviceType.PMSensor) { if (bindDev.BindCluster == 1029) { - targetList.Add(device); oldTargetList.Add(device); } } @@ -1513,7 +1448,6 @@ { if (bindDev.BindCluster == 1066) { - targetList.Add(device); oldTargetList.Add(device); } } @@ -1523,12 +1457,18 @@ { if (bindDev.BindCluster == 513) { - targetList.Add(device); oldTargetList.Add(device); } } break; } + + targetList.Clear(); + if (oldTargetList.Count != 0) + { + targetList.Add(oldTargetList[0]); + } + targetListTemp.Clear(); foreach (var d in targetList) { @@ -1588,14 +1528,26 @@ removeDevice.BindCluster = 1066; break; case BindInfo.BindType.AC: - removeDevice.BindCluster = 513; + removeDevice.BindCluster = 513;//Ac闇�瑕佺粦瀹�2涓皣513鍜�514 break; } removeDevice.BindMacAddr = bd.DeviceAddr; removeDevice.BindEpoint = bd.DeviceEpoint; delDevice.RemoveBindList.Add(removeDevice); + + if (curDeviceBindType == BindInfo.BindType.AC) + { + //瑕佺Щ闄ょ┖璋冿細闇�瑕佺Щ闄�513锛�514 + var removeDevice3 = new RemoveBindListObj(); + removeDevice3.BindCluster = 514; + removeDevice3.BindType = 0; + removeDevice3.BindMacAddr = bd.DeviceAddr; + removeDevice3.BindEpoint = bd.DeviceEpoint; + delDevice.RemoveBindList.Add(removeDevice3); + } return delDevice; } + #endregion #region 绉婚櫎鏂规硶 -- Gitblit v1.8.0