From dc6493db59dcb0893eac50b72122f94c24056b3f Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期一, 12 十月 2020 14:35:39 +0800
Subject: [PATCH] 新版本
---
ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/PaneTargetsBaseForm.cs | 635 +++++++++++++++++++++++++++++++--------------------------
1 files changed, 347 insertions(+), 288 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/PaneTargetsBaseForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/PaneTargetsBaseForm.cs
index d7e25e7..37af8dc 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/PaneTargetsBaseForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/Bind/PaneTargetsBaseForm.cs
@@ -7,6 +7,9 @@
using static ZigBee.Device.Panel;
namespace Shared.Phone.UserCenter.Device.Bind
{
+ /// <summary>
+ /// 鐗规畩闈㈡澘鐨勭粦瀹氱晫闈€�愬彧鑳界粦瀹氱壒瀹氱被鍨嬶紝姣忕绫诲瀷鍙湁涓�涓洰鏍囥��
+ /// </summary>
public class PaneTargetsBaseForm : BindCommonLayout
{
#region 鏋勯�犲嚱鏁�
@@ -14,7 +17,7 @@
/// 鏋勯�犲嚱鏁�
/// </summary>
/// <param name="device"></param>
- /// <param name="deviceBindType">1:鏂伴;2:娓╁害浼犳劅鍣�;3:婀垮害浼犳劅鍣�;4:PM2.5浼犳劅鍣�;5:绌鸿皟鐩爣</param>
+ /// <param name="deviceBindType">1:鏂伴;2:娓╁害浼犳劅鍣�;3:婀垮害浼犳劅鍣�;4:PM2.5浼犳劅鍣�;5:绌鸿皟鐩爣,6:鍦版殩鐩爣銆愭殏鏃舵病鍋氾紝鍥犱负娌℃湁璇ヨ澶囷紝鍚庢湡澧炲姞銆�</param>
/// <param name="bindDev">缁戝畾鐩爣 </param>
public PaneTargetsBaseForm(CommonDevice device, CommonDevice bindDev, DeviceBind.BindInfo.BindType deviceBindType)
{
@@ -68,6 +71,7 @@
/// 3:婀垮害浼犳劅鍣�
/// 4:PM2.5浼犳劅鍣�
/// 5:绌鸿皟鐩爣
+ /// 6:鍦版殩鐩爣銆愭殏鏃舵病鍋氾紝鍥犱负娌℃湁璇ヨ澶囷紝鍚庢湡澧炲姞銆�
/// </summary>
DeviceBind.BindInfo.BindType curDeviceBindType = 0;
/// <summary>
@@ -93,7 +97,7 @@
/// <summary>
/// 妤煎眰鍒楄〃
/// </summary>
- Dictionary<string, string> dicFloorList;
+ Dictionary<string, string> dicFloorList = new Dictionary<string, string> { };
/// <summary>
/// 鎵�鏈夋埧闂翠腑鏀寔琚粦瀹氱殑璁惧鍒楄〃
/// </summary>
@@ -130,7 +134,14 @@
/// Ac缁戝畾鐩爣鍥炶皟
/// </summary>
public Action<string> actionAcTarget = null;
-
+ /// <summary>
+ /// Fh缁戝畾鐩爣鍥炶皟
+ /// </summary>
+ public Action<string> actionFhTarget = null;
+ /// <summary>
+ /// 鏄惁鑳藉埛鏂�
+ /// </summary>
+ private bool canFresh = false;
#endregion
#region UI璁捐
@@ -143,6 +154,7 @@
//鏍囬鏍忎笅鐨刄I
MidFrameLayoutContent();
//鍒濆鍖栬澶囨暟鎹�
+ CommonPage.Loading.Start("");
InitData();
}
@@ -169,6 +181,9 @@
case DeviceBind.BindInfo.BindType.AC:
titleText = Language.StringByID(R.MyInternationalizationString.AcTargets);
break;
+ case DeviceBind.BindInfo.BindType.Fh:
+ titleText = Language.StringByID(R.MyInternationalizationString.uFloorHeatingTarget);
+ break;
}
this.TopFrameLayout(this, titleText);
EventHandler<MouseEventArgs> eHandlerBack = (sender, e) =>
@@ -184,7 +199,7 @@
/// <summary>
/// 涓儴UI銆愭爣棰樻爮涓嬬殑UI銆�
/// </summary>
- async void MidFrameLayoutContent()
+ void MidFrameLayoutContent()
{
var btnMidTopLayout = new FrameLayout
{
@@ -208,6 +223,7 @@
this.midFrameLayout.AddChidren(midVerticalScrolViewLayout);
midVerticalScrolViewLayout.BeginHeaderRefreshingAction += () =>
{
+ canFresh = true;
midVerticalScrolViewLayout.BeginHeaderRefreshing();
InitData();
};
@@ -221,20 +237,24 @@
};
this.midFrameLayout.AddChidren(bottomFrameLayout);
+ var bottomTipPicFrameLayout = new FrameLayout()
+ {
+ Height = Application.GetMinReal(40 + 44 - 10),
+ };
+ bottomFrameLayout.AddChidren(bottomTipPicFrameLayout);
+
var btnTipPicFrameLayout = new FrameLayout()
{
- Width = Application.GetMinReal(40 + 23 + 37),
+ Width = Application.GetMinReal(23 + 37),
Height = Application.GetMinReal(40 + 44 - 10),
- X = Application.GetMinReal(383 - 37),
};
- bottomFrameLayout.AddChidren(btnTipPicFrameLayout);
+ bottomTipPicFrameLayout.AddChidren(btnTipPicFrameLayout);
btnTipPic = new Button()
{
Width = Application.GetMinReal(40),
Height = Application.GetMinReal(40),
- X = Application.GetMinReal(40),
- Y = Application.GetRealHeight(22),
+ Y = Application.GetRealHeight(19),
UnSelectedImagePath = "BindPic/EmptyTargets.png",
SelectedImagePath = "BindPic/EmptyTargetsSelected.png",
};
@@ -243,14 +263,16 @@
btnTipText = new Button()
{
Height = Application.GetRealHeight(84 - 10),
- X = Application.GetMinReal(444),
+ X = Application.GetMinReal(58),
Width = Application.GetMinReal(1080 - 446),
TextID = R.MyInternationalizationString.BindEmptyTargets,
- TextColor = Shared.Common.ZigbeeColor.Current.XMGray3,//XMTopTitleText
+ TextColor = Shared.Common.ZigbeeColor.Current.XMGray3,
TextSize = 12,
TextAlignment = TextAlignment.CenterLeft,
};
- bottomFrameLayout.AddChidren(btnTipText);
+ bottomTipPicFrameLayout.AddChidren(btnTipText);
+ bottomTipPicFrameLayout.Width = btnTipPicFrameLayout.Width + Application.GetMinReal(12) + btnTipText.GetTextWidth();
+ bottomTipPicFrameLayout.Gravity = Gravity.CenterHorizontal;
EventHandler<MouseEventArgs> eHandlerEmptyTargets = (sender, e) =>
{
@@ -306,20 +328,19 @@
void RefreshRoomList()
{
Room curRoom = null;
- if (supportRoomList.Count == 0)
- {
- return;
- }
btnHorizontalScrolViewLayout.RemoveAll();
Button curentOldRoom = null;
FrameLayout curentOldRoomFrameLayout = null;
int index = 0;
- var roomTempList = BindInfo.GetSupportRoomList(curControlDev, supportRoomList, curDeviceBindType);
Room slectedRoom = null;
-
var roomUn = new Room();
roomUn.Name = Language.StringByID(R.MyInternationalizationString.Undistributed);
roomUn.Id = "UndistributedId";
+ List<Room> roomTempList = new List<Room> { };
+ if (supportRoomList.Count != 0)
+ {
+ roomTempList = BindInfo.GetSupportRoomList(curControlDev, supportRoomList, curDeviceBindType);
+ }
if (undistruibuteDevList.Count != 0)
{
roomTempList.Add(roomUn);
@@ -379,7 +400,7 @@
}
}
- if (index == roomTempList.Count - 1 && index > 3)
+ if (index == roomTempList.Count - 1 && index > 2)
{
var btnRoomFrameLayoutEmpty = new FrameLayout
{
@@ -445,6 +466,8 @@
var btn = (Button)frame.GetChildren(0);
frame.BackgroundImagePath = "Item/RoomIconBackgroundSelected.png";
btn.TextColor = Shared.Common.ZigbeeColor.Current.XMWhite;
+ curentOldRoom = btn;
+ curentOldRoomFrameLayout = frame;
}
else
{
@@ -464,7 +487,6 @@
midVerticalScrolViewLayout.RemoveAll();
Button oldDevice = null;
int curIndex = 0;
-
if (curRoom.Id == "UndistributedId")
{
currentRoomSupportBindDeviceList = BindInfo.GetUndistributeDeviceList(undistruibuteDevList, curDeviceBindType);
@@ -640,6 +662,26 @@
btnChoose.MouseUpEventHandler += hander;
curIndex++;
}
+
+ //棣栨鏄惁鑳界偣鍑讳繚瀛�
+ if (targetList.Count == 0)
+ {
+ if (targetListTemp.Count == 0)
+ {
+ btnFinifh.Enable = false;
+ btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect;
+ }
+ else
+ {
+ btnFinifh.Enable = true;
+ btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
+ }
+ }
+ else
+ {
+ btnFinifh.Enable = true;
+ btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
+ }
}
#endregion
@@ -648,23 +690,19 @@
/// <summary>
/// 鍒濆鍖栬澶囨暟鎹�
/// </summary>
- void InitData()
+ void InitData(bool canUpdateBindName = false)
{
System.Threading.Tasks.Task.Run(async () =>
{
try
{
- Application.RunOnMainThread(() =>
- {
- CommonPage.Loading.Start("");
- });
//鑾峰彇琚粦鐩爣绛変俊鎭�
BindDevInfo(curBindDevice);
- //鑾峰彇妤煎眰
+ //鑾峰彇妤煎眰
dicFloorList = HdlRoomLogic.Current.GetFloorSortList();
- //鑾峰彇妤煎眰涓埧闂村垪琛�
- supportRoomList = BindInfo.GetFloorRoomList();
+ //鑾峰彇鎴块棿鍒楄〃
+ supportRoomList = BindInfo.GetSupportRoomList();
//鑾峰彇鎵�鏈夋埧闂翠腑鍖归厤鐨勮兘缁戠殑鐩爣
currentPanelSupportBindDeviceList = BindInfo.GetAllRoomSupportDeviceList(currentPanelSupportBindDeviceList, supportRoomList, curDeviceBindType);
@@ -685,13 +723,27 @@
{
Application.RunOnMainThread(() =>
{
- CommonPage.Loading.Hide();
+ canFresh = false;
midVerticalScrolViewLayout.EndHeaderRefreshing();
- new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance);
+ CommonPage.Loading.Hide();
+ new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime) + "(" + "5007" + ")", Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance);
+
+ this.midFrameLayout.RemoveAll();
+
+ ShowReLoadView();
+ ReLoadAction += () =>
+ {
+ this.midFrameLayout.RemoveAll();
+ //鍒濆鍖栬澶囨暟鎹�
+ CommonPage.Loading.Start("");
+ MidFrameLayoutContent();
+ InitData(true);
+ };
+
});
}
- targetList.Clear();
+ oldTargetList.Clear();
//閫変腑鐩爣鍒楄〃 targetList
if (curControlDev.bindList.Count != 0)
{
@@ -700,7 +752,7 @@
var mainKey = bindDev.BindMacAddr + bindDev.BindEpoint;
//鍒嗛厤鐨勭洰鏍囧垪琛�
- if (currentPanelSupportBindDeviceList.Count != 0)
+ if (Shared.Common.LocalDevice.Current.listAllDevice.Count != 0)
{
var dev = currentPanelSupportBindDeviceList.Find(obj => (obj != null) && (obj.DeviceAddr + obj.DeviceEpoint == mainKey));
if (dev != null)
@@ -738,31 +790,44 @@
{
Application.RunOnMainThread(() =>
{
- BindDownFrameLayout(this.midFrameLayout, curControlDev, dicFloorList, ref btnFloorText);
+ //妤煎眰渚ц竟鏍忕粦瀹�
+ if (!canFresh)
+ {
+ BindDownFrameLayout(this.midFrameLayout, curControlDev, dicFloorList, ref btnFloorText);
+ }
ChooseFloorAction += (floorId, btnMethodText) =>
{
+ btnFloorText.Text = string.Empty;
btnFloorText.Text = dicFloorList[floorId];
- //鑾峰彇妤煎眰涓埧闂村垪琛�
- supportRoomList = BindInfo.GetFloorRoomList();
+ //鑾峰彇鎴块棿鍒楄〃
+ supportRoomList = BindInfo.GetSupportRoomList();
//鑾峰彇鏈湴鏈垎閰嶇殑鏀寔褰撳墠绫诲瀷鐨勭粦瀹氳澶囧垪琛�
undistruibuteDevList = BindInfo.GetUndistributeDeviceList(undistruibuteDevList, curDeviceBindType);
RefreshRoomList();
};
+
+ //榛樿妤煎眰鏄剧ず
+ if (BindInfo.GetCurrentSelectFloorIdName() != null)
+ {
+ Application.RunOnMainThread(() =>
+ {
+ btnFloorText.Text = BindInfo.GetCurrentSelectFloorIdName();
+ });
+ }
//棣栨鏄惁鑳界偣鍑讳繚瀛�
if (targetList.Count == 0)
{
curControlDev.currentSelectFloorId = BindInfo.GetCurrentSelectFloorId();
curControlDev.currentSelectRoomId = null;
- if (BindInfo.GetCurrentSelectFloorIdName() != null)
- {
- Application.RunOnMainThread(() =>
- {
- btnFloorText.Text = BindInfo.GetCurrentSelectFloorIdName();
- });
- }
btnFinifh.Enable = false;
btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect;
+
+ //鏇存柊澶栭潰鐩爣鍚嶅瓧锛氭棤
+ if (canUpdateBindName)
+ {
+ TargesBindName();
+ }
}
else
{
@@ -785,6 +850,28 @@
curControlDev.currentSelectRoomId = "UndistributedId";
}
}
+
+ if (canUpdateBindName)
+ {
+ //鏇存柊澶栭潰鐩爣鍚嶅瓧锛氬叿浣撳悕瀛椼�愬埛鏂版湰鍦扮晫闈細瀵艰嚧澶栭儴鐩爣鍙樺寲銆�
+ string bindName = Common.LocalDevice.Current.GetDeviceEpointName(dev);
+ switch (curDeviceBindType)
+ {
+ case BindInfo.BindType.Temperature:
+ if (dev.Type == DeviceType.PMSensor)
+ {
+ bindName += "-" + Language.StringByID(R.MyInternationalizationString.TemperatureSensor);
+ }
+ break;
+ case BindInfo.BindType.Humidity:
+ if (dev.Type == DeviceType.PMSensor)
+ {
+ bindName += "-" + Language.StringByID(R.MyInternationalizationString.HumiditySensor);
+ }
+ break;
+ }
+ TargesBindName(bindName);
+ }
}
if (!string.IsNullOrEmpty(curControlDev.currentSelectFloorId))
{
@@ -798,15 +885,11 @@
btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
}
-
//鑾峰彇妤煎眰涓埧闂村垪琛�
- if (supportRoomList.Count != 0)
- {
- RefreshRoomList();
- }
-
- CommonPage.Loading.Hide();
+ RefreshRoomList();
+ canFresh = false;
midVerticalScrolViewLayout.EndHeaderRefreshing();
+ CommonPage.Loading.Hide();
});
}
});
@@ -827,75 +910,94 @@
try
{
Application.RunOnMainThread(() => { CommonPage.Loading.Start(""); });
-
- if (oldTargetList.Count != 0)
+ if (btnTipPic.IsSelected)
{
- //鍒犻櫎鍙栨秷鐨勭洰鏍�
- foreach (var bd in oldTargetList)
+ //褰撶粦瀹氱┖鐩爣锛岃鍒犻櫎宸茬粡瀛樺湪鎸夐敭鐨勭洰鏍�
+ if (oldTargetList.Count != 0)
{
- var delDevice = new DelDeviceBindData();
- delDevice.DeviceAddr = curControlDev.DeviceAddr;
- delDevice.Epoint = curControlDev.DeviceEpoint;
+ //鍒犻櫎鎸夐敭涓凡缁忕粦瀹氱殑鐩爣涓暟銆愬垹闄ゆ垚鍔熶釜鏁般��
+ int sOldTargetListCount = 0;
- var removeDevice = new RemoveBindListObj();
- removeDevice.BindType = 0;
- switch (curDeviceBindType)
+ foreach (var bd in oldTargetList)
{
- 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);
+ var delDevice = DelBindDevice(bd);
- 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);
- if (delResult == null)
- {
- Application.RunOnMainThread(() =>
+ var delResult = new DelDeviceBindResponseAllData();
+ delResult = HdlDeviceBindLogic.Current.DelDeviceBindAsync(delDevice);
+ if (delResult == null)
{
- 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 (delResult.removeBindResultResponseData == null)
- {
- if (delResult.delDeviceBindResponseData != null)
+ Application.RunOnMainThread(() =>
{
- foreach (var d in delResult.delDeviceBindResponseData.RemoveBindList)
+ new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFailed) + "(" + "5003_1" + ")", Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance);
+ CommonPage.Loading.Hide();
+
+ ShowReLoadView();
+ ReLoadAction += () =>
{
- if (d.Result == 0 || d.Result == 1)
+ 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)
{
- EmptyTargesMess();
+ if (d.Result == 0 || d.Result == 1)
+ {
+ sRemoveBindListCount++;
+ if (sRemoveBindListCount == delDevice.RemoveBindList.Count)
+ {
+ sOldTargetListCount++;
+ }
+
+ //鎸夐敭鐩爣涓殑璇ョ被鍨嬩釜鏁伴兘鍒犻櫎鎴愬姛
+ if (sOldTargetListCount == oldTargetList.Count)
+ {
+ TargesBindName();
+ Application.RunOnMainThread(() =>
+ {
+ CommonPage.Loading.Hide();
+ btnFinifh.Enable = true;
+ btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
+ this.RemoveFromParent();
+ });
+ }
+ }
+ else
+ {
+ Application.RunOnMainThread(() =>
+ {
+ new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFailed) + "(" + "5003_3" + ")", Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance);
+ btnFinifh.Enable = true;
+ btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
+ CommonPage.Loading.Hide();
+ });
+ return;
+ }
+ }
+ }
+ }
+ else
+ {
+ if (delResult.removeBindResultResponseData.Result == 0)
+ {
+ sOldTargetListCount++;
+ //鎸夐敭鐩爣涓殑璇ョ被鍨嬩釜鏁伴兘鍒犻櫎鎴愬姛
+ if (sOldTargetListCount == oldTargetList.Count)
+ {
+ TargesBindName();
Application.RunOnMainThread(() =>
{
CommonPage.Loading.Hide();
@@ -904,54 +1006,26 @@
this.RemoveFromParent();
});
}
- else
- {
- 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 (delResult.removeBindResultResponseData.Result == 0)
- {
- EmptyTargesMess();
- Application.RunOnMainThread(() =>
+ else
{
- CommonPage.Loading.Hide();
- btnFinifh.Enable = true;
- btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
- this.RemoveFromParent();
- });
-
- }
- else
- {
- 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;
+ Application.RunOnMainThread(() =>
+ {
+ new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFailed) + "(" + "5003_2" + ")", Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance);
+ btnFinifh.Enable = true;
+ btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
+ CommonPage.Loading.Hide();
+ });
+ return;
+ }
}
}
}
}
- }
- else
- {
- if (btnTipPic.IsSelected)
+ else
{
- EmptyTargesMess();
+ //鎸夐敭涓病鏈夌洰鏍囩洿鎺ョ粦瀹氱┖鐩爣
+ TargesBindName();
Application.RunOnMainThread(() =>
{
CommonPage.Loading.Hide();
@@ -959,22 +1033,6 @@
btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
this.RemoveFromParent();
});
- }
- else
- {
- //娌℃湁鐩爣鎻愮ず
- Application.RunOnMainThread(() =>
- {
- var myTip = new Tip();
- myTip.Direction = AMPopTipDirection.None;
- myTip.CloseTime = 2;
- myTip.Text = Language.StringByID(R.MyInternationalizationString.BindDeviceTargetIsEmpty);
- myTip.Show(Common.CommonPage.Instance);
- btnFinifh.Enable = true;
- btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
- CommonPage.Loading.Hide();
- });
- return;
}
}
}
@@ -986,6 +1044,8 @@
CommonPage.Loading.Hide();
});
btnFinifh.Enable = true;
+ btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
+
}
});
}
@@ -1014,11 +1074,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);
@@ -1027,10 +1093,18 @@
{
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;
+ new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFailed) + "(" + "5003_4" + ")", Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance);
CommonPage.Loading.Hide();
+
+ ShowReLoadView();
+ ReLoadAction += () =>
+ {
+ this.midFrameLayout.RemoveAll();
+ //鍒濆鍖栬澶囨暟鎹�
+ CommonPage.Loading.Start("");
+ MidFrameLayoutContent();
+ InitData(true);
+ };
});
return;
}
@@ -1046,91 +1120,50 @@
{
Application.RunOnMainThread(() =>
{
- new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFailed), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance);
+ new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFailed) + "(" + "5003_6" + ")", Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance);
btnFinifh.Enable = true;
btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
CommonPage.Loading.Hide();
});
return;
}
+
+ sRemoveBindListCount++;
+ if (sRemoveBindListCount == delDevice.RemoveBindList.Count)
+ {
+ 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) + "(" + "5003_5" + ")", Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance);
+ btnFinifh.Enable = true;
+ btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
+ CommonPage.Loading.Hide();
+ });
+ return;
+ }
+ sOldTargetListCount++;
}
}
}
- }
- else
- {
- //妫�娴嬪凡缁忕粦瀹氱殑鐩爣鏄惁涓嶅湪鏈湴鎴栬�呮病鏈夊垎閰嶅埌浠讳綍鎴块棿涓�
- //姝ゆ椂闇�瑕佸垹闄ゅ凡缁忚缁戝畾鍒扮洰鏍囷紝鎵嶈兘缁х画缁戝畾鏂扮洰鏍�
- if (curBindDevice != null)
- {
- var delDevice = DelBindDevice(curBindDevice);
- var delResult = new DelDeviceBindResponseAllData();
- delResult = HdlDeviceBindLogic.Current.DelDeviceBindAsync(delDevice);
- if (delResult == null)
+ if (sOldTargetListCount != oldTargetList.Count)
+ {
+ Application.RunOnMainThread(() =>
{
- 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 (delResult.removeBindResultResponseData == null)
- {
- if (delResult.delDeviceBindResponseData != null)
- {
- foreach (var d in delResult.delDeviceBindResponseData.RemoveBindList)
- {
- if (d.Result != 0 && d.Result != 1)
- {
- 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;
- }
- }
- }
- }
- }
- 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;
- }
- }
+ new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFailed) + "(" + "5003_7" + ")", Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance);
+ btnFinifh.Enable = true;
+ btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
+ CommonPage.Loading.Hide();
+ });
+ return;
}
}
@@ -1203,10 +1236,17 @@
Application.RunOnMainThread(() =>
{
CommonPage.Loading.Hide();
- new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance);
- btnFinifh.Enable = true;
- btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
- return;
+ new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime) + "(" + "5001" + ")", Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(CommonPage.Instance);
+
+ ShowReLoadView();
+ ReLoadAction += () =>
+ {
+ this.midFrameLayout.RemoveAll();
+ //鍒濆鍖栬澶囨暟鎹�
+ CommonPage.Loading.Start("");
+ MidFrameLayoutContent();
+ InitData(true);
+ };
});
}
else
@@ -1215,39 +1255,8 @@
{
targetList.Clear();
targetListTemp.Clear();
- switch (curDeviceBindType)
- {
- case BindInfo.BindType.FreshAir:
- if (actionFreshAirTarget != null)
- {
- actionFreshAirTarget(addBindeDev.BindName);
- }
- break;
- case BindInfo.BindType.Temperature:
- if (actionTemperatureTarget != null)
- {
- actionTemperatureTarget(addBindeDev.BindName);
- }
- break;
- case BindInfo.BindType.Humidity:
- if (actionHumidityTarget != null)
- {
- actionHumidityTarget(addBindeDev.BindName);
- }
- break;
- case BindInfo.BindType.PM:
- if (actionPMTarget != null)
- {
- actionPMTarget(addBindeDev.BindName);
- }
- break;
- case BindInfo.BindType.AC:
- if (actionAcTarget != null)
- {
- actionAcTarget(addBindeDev.BindName);
- }
- break;
- }
+
+ TargesBindName(addBindeDev.BindName);
Application.RunOnMainThread(() =>
{
@@ -1267,7 +1276,7 @@
new Tip()
{
MaxWidth = 150,
- Text = Language.StringByID(R.MyInternationalizationString.BindFailed),
+ Text = Language.StringByID(R.MyInternationalizationString.BindFailed) + "(" + "5001_1" + ")",
Direction = AMPopTipDirection.None,
CloseTime = 1
}.Show(CommonPage.Instance);
@@ -1283,7 +1292,7 @@
new Tip()
{
MaxWidth = 150,
- Text = Language.StringByID(R.MyInternationalizationString.BindUnknownError),
+ Text = Language.StringByID(R.MyInternationalizationString.BindUnknownError) + "(" + "5001_2" + ")",
Direction = AMPopTipDirection.None,
CloseTime = 1
}.Show(CommonPage.Instance);
@@ -1308,9 +1317,9 @@
}
/// <summary>
- /// 鐩爣涓虹┖鏃剁殑鏂囨湰鏄剧ず
+ /// 鐩爣涓烘枃鏈樉绀�
/// </summary>
- void EmptyTargesMess()
+ void EmptyTargesMess1()
{
switch (curDeviceBindType)
{
@@ -1346,6 +1355,45 @@
break;
}
}
+ /// <summary>
+ /// 鐩爣涓烘枃鏈樉绀�
+ /// </summary>
+ void TargesBindName(string name = "")
+ {
+ switch (curDeviceBindType)
+ {
+ case BindInfo.BindType.FreshAir:
+ if (actionFreshAirTarget != null)
+ {
+ actionFreshAirTarget(name);
+ }
+ break;
+ case BindInfo.BindType.Temperature:
+ if (actionTemperatureTarget != null)
+ {
+ actionTemperatureTarget(name);
+ }
+ break;
+ case BindInfo.BindType.Humidity:
+ if (actionHumidityTarget != null)
+ {
+ actionHumidityTarget(name);
+ }
+ break;
+ case BindInfo.BindType.PM:
+ if (actionPMTarget != null)
+ {
+ actionPMTarget(name);
+ }
+ break;
+ case BindInfo.BindType.AC:
+ if (actionAcTarget != null)
+ {
+ actionAcTarget(name);
+ }
+ break;
+ }
+ }
/// <summary>
/// 缁戝畾鐩爣鍒楄〃
@@ -1364,7 +1412,6 @@
{
if (device.Type == DeviceType.FreshAir)
{
- targetList.Add(device);
oldTargetList.Add(device);
}
}
@@ -1375,7 +1422,6 @@
var bDev = device as TemperatureSensor;
if (bDev.SensorDiv == 1)
{
- targetList.Add(device);
oldTargetList.Add(device);
}
}
@@ -1383,7 +1429,6 @@
{
if (bindDev.BindCluster == 1026)
{
- targetList.Add(device);
oldTargetList.Add(device);
}
}
@@ -1394,20 +1439,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);
}
}
@@ -1417,7 +1459,6 @@
{
if (bindDev.BindCluster == 1066)
{
- targetList.Add(device);
oldTargetList.Add(device);
}
}
@@ -1427,12 +1468,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)
{
@@ -1492,14 +1539,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