using System;
|
using System.Collections.Generic;
|
using Shared.Common;
|
using Shared.Phone.UserCenter.Device.Bind;
|
using ZigBee.Device;
|
using static ZigBee.Device.BindObj;
|
namespace Shared.Phone.UserCenter.DeviceBind
|
{
|
public class PanelSimpleMutilfunctionAddTargetsForm : BindCommonLayout
|
{
|
#region 构造函数
|
/// <summary>
|
/// 构造函数
|
/// </summary>
|
/// <param name="device"></param>
|
/// <param name="deviceBindType">0:场景 1:开关 2:插座 3:灯光 4:遮阳 5:空调 6:新风</param>
|
public PanelSimpleMutilfunctionAddTargetsForm(Panel controlDev, int deviceBindType)
|
{
|
this.curControlDev = controlDev;
|
this.curBindType = deviceBindType;
|
}
|
#endregion
|
|
#region 变量申明
|
/// <summary>
|
/// 控制设备
|
/// </summary>
|
Panel curControlDev;
|
/// <summary>
|
/// 当前被绑设备
|
/// </summary>
|
CommonDevice curBindDevice;
|
/// <summary>
|
/// 显示被绑定设备或场景的view
|
/// </summary>
|
VerticalFrameRefreshControl midVerticalScrolViewLayout;
|
/// <summary>
|
/// 显示房间的view
|
/// </summary>
|
HorizontalScrolViewLayout btnHorizontalScrolViewLayout;
|
/// <summary>
|
/// 当前设备绑定类型 0:场景 1:开关 2:插座 3:灯光 4:遮阳 5:空调 6:新风
|
/// </summary>
|
int curBindType = 0;
|
/// <summary>
|
/// 本地房间列表
|
/// </summary>
|
List<Room> supportRoomList = new List<Room>();
|
/// <summary>
|
/// 保存完成按钮
|
/// </summary>
|
Button btnFinifh;
|
/// <summary>
|
/// 绑定类型提示文本
|
/// </summary>
|
Button btnTipText;
|
/// <summary>
|
/// 楼层文本
|
/// </summary>
|
Button btnFloorText;
|
/// <summary>
|
/// 楼层列表
|
/// </summary>
|
Dictionary<string, string> dicFloorList = new Dictionary<string, string>();
|
/// <summary>
|
/// 按键配置的目标列表
|
/// </summary>
|
List<CommonDevice> targetList = new List<CommonDevice>();
|
/// <summary>
|
/// 按键配置的目标列表
|
/// </summary>
|
List<SceneUI> targetScList = new List<SceneUI>();
|
/// <summary>
|
/// 所有房间中支持被绑定的设备列表
|
/// </summary>
|
List<CommonDevice> currentPanelSupportBindDeviceList = new List<CommonDevice>();
|
/// <summary>
|
/// 所有房间中支持被绑定的场景列表
|
/// </summary>
|
List<SceneUI> currentPanelSupportBindSceneList = new List<SceneUI>();
|
/// <summary>
|
/// 当前类型的绑定表
|
/// </summary>
|
List<BindListAllInfo> curBindTypeList = new List<BindListAllInfo>();
|
/// <summary>
|
/// 未分配的设备列表
|
/// </summary>
|
List<CommonDevice> undistributeDevList = new List<CommonDevice>();
|
/// <summary>
|
/// 未分配的设备列表
|
/// </summary>
|
List<SceneUI> undistributeScList = new List<SceneUI>();
|
/// <summary>
|
/// 当前房间中支持被绑定的设备列表
|
/// </summary>
|
List<CommonDevice> currentRoomSupportBindDeviceList = new List<CommonDevice>();
|
/// <summary>
|
/// 当前房间中支持被绑定的设备列表
|
/// </summary>
|
List<SceneUI> currentRoomSupportBindSceneList = new List<SceneUI>();
|
/// <summary>
|
/// 当前支持的端点绑定表
|
/// </summary>
|
List<int> curSupportBindEpointList = new List<int>();
|
/// <summary>
|
/// 当前被选择目标即将绑定的端点
|
/// </summary>
|
List<int> curSendEpointList = new List<int>();
|
/// <summary>
|
/// 当前支持的调光个数[存调光灯光的设备]
|
/// </summary>
|
List<int> curSupportDimmerEpointList = new List<int>();
|
/// <summary>
|
/// 当前支持的调光开关个数[存继电器的功能类型是灯光的设备]
|
/// </summary>
|
List<int> curSupportLightEpointList = new List<int>();
|
/// <summary>
|
/// 面板中存在的键值
|
/// </summary>
|
List<String> panelBindListKey = null;
|
/// <summary>
|
/// 刷新绑定表页面
|
/// </summary>
|
public Action actionRefreshBindList;
|
/// <summary>
|
/// 是否能刷新
|
/// </summary>
|
private bool canFresh = false;
|
#endregion
|
|
#region UI设计
|
/// <summary>
|
/// 目标页显示
|
/// </summary>
|
public void Show()
|
{
|
TitleUI();
|
MidFrameLayouUI();
|
//首次初始化数据
|
CommonPage.Loading.Start("");
|
InitData();
|
|
//备注弹窗提示
|
string msg = Language.StringByID(R.MyInternationalizationString.BindRemarkTip1).Replace("{0}", "\r\n");
|
var alert = new Shared.Phone.ShowMsgControl(ShowMsgType.Confirm, msg, Language.StringByID(R.MyInternationalizationString.Iknown));
|
alert.Show();
|
}
|
|
/// <summary>
|
/// 标题栏
|
/// </summary>
|
void TitleUI()
|
{
|
string titleText = Language.StringByID(R.MyInternationalizationString.Bind);
|
switch (curBindType)
|
{
|
case 0:
|
titleText += Language.StringByID(R.MyInternationalizationString.scene);
|
break;
|
case 1:
|
titleText += Language.StringByID(R.MyInternationalizationString.uDeviceBelongId13);
|
break;
|
case 2:
|
titleText += Language.StringByID(R.MyInternationalizationString.uDeviceBelongId14);
|
break;
|
case 3:
|
titleText += Language.StringByID(R.MyInternationalizationString.uDeviceBelongId15);
|
break;
|
case 4:
|
titleText += Language.StringByID(R.MyInternationalizationString.uDeviceBelongId200);
|
break;
|
case 5:
|
titleText += Language.StringByID(R.MyInternationalizationString.uDeviceBelongId3600);
|
break;
|
case 6:
|
titleText += Language.StringByID(R.MyInternationalizationString.uDeviceBelongId2310);
|
break;
|
}
|
this.TopFrameLayout(this, titleText);
|
EventHandler<MouseEventArgs> eHandlerBack = (sender, e) =>
|
{
|
RemoveFromParent();
|
};
|
this.btnTitle.Width = Application.GetRealWidth(1080 - 161 - 300);
|
this.btnBack.MouseUpEventHandler += eHandlerBack;
|
this.btnBackFrameLayout.MouseUpEventHandler += eHandlerBack;
|
this.MidFrameLayout(this);
|
}
|
|
/// <summary>
|
/// 中部UI【标题栏下的UI】
|
/// </summary>
|
void MidFrameLayouUI()
|
{
|
var btnMidTopLayout = new FrameLayout
|
{
|
Height = Application.GetRealHeight(389 - 184),
|
};
|
this.midFrameLayout.AddChidren(btnMidTopLayout);
|
|
//房间栏
|
btnHorizontalScrolViewLayout = new HorizontalScrolViewLayout
|
{
|
X = Application.GetRealWidth(58),
|
};
|
btnMidTopLayout.AddChidren(btnHorizontalScrolViewLayout);
|
|
//设备栏
|
midVerticalScrolViewLayout = new VerticalFrameRefreshControl()
|
{
|
Y = btnMidTopLayout.Bottom,
|
Height = Application.GetRealHeight(1145),
|
};
|
this.midFrameLayout.AddChidren(midVerticalScrolViewLayout);
|
midVerticalScrolViewLayout.BeginHeaderRefreshingAction += () =>
|
{
|
midVerticalScrolViewLayout.BeginHeaderRefreshing();
|
canFresh = true;
|
InitData();
|
};
|
|
//底部保存栏
|
var bottomFrameLayout = new FrameLayout()
|
{
|
Width = LayoutParams.MatchParent,
|
Height = Application.GetRealHeight(84 * 2 + 127),
|
Y = Application.GetRealHeight(1388),
|
};
|
this.midFrameLayout.AddChidren(bottomFrameLayout);
|
|
btnTipText = new Button()
|
{
|
Height = Application.GetRealHeight(84),
|
TextID = R.MyInternationalizationString.Tip,
|
TextColor = Shared.Common.ZigbeeColor.Current.XMGray3,
|
TextSize = 12,
|
TextAlignment = TextAlignment.Center,
|
};
|
bottomFrameLayout.AddChidren(btnTipText);
|
|
btnFinifh = new Button()
|
{
|
Width = Application.GetRealWidth(907),
|
Height = Application.GetRealHeight(127),
|
Y = Application.GetRealHeight(49 + 35),
|
Gravity = Gravity.CenterHorizontal,
|
Radius = (uint)Application.GetRealHeight(127) / 2,
|
TextID = R.MyInternationalizationString.Save,
|
BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack,
|
TextColor = Shared.Common.ZigbeeColor.Current.XMWhite,
|
IsBold = true,
|
TextSize = 16,
|
};
|
bottomFrameLayout.AddChidren(btnFinifh);
|
btnFinifh.MouseUpEventHandler += (sender, e) =>
|
{
|
curSendEpointList.Clear();
|
SaveTarget();
|
};
|
}
|
|
/// <summary>
|
/// 面板绑定目标表显示
|
/// </summary>
|
/// <param name="gateway">Gateway.</param>
|
/// <param name="key">Key.</param>
|
void RefreshRoomList()
|
{
|
btnHorizontalScrolViewLayout.RemoveAll();
|
Room curRoom = null;
|
Button curentOldRoom = null;
|
FrameLayout curentOldRoomFrameLayout = null;
|
int index = 0;
|
List<Room> roomTempList = new List<Room> { };
|
Room slectedRoom = null;
|
var roomUn = new Room();
|
roomUn.Name = Language.StringByID(R.MyInternationalizationString.Undistributed);
|
roomUn.Id = "UndistributedId";
|
|
if (supportRoomList.Count != 0)
|
{
|
roomTempList = MutilfunctionPanelMethod.GetSupportRoomList(curControlDev, supportRoomList, curBindTypeList, curBindType);
|
}
|
|
if (curBindType == 0)
|
{
|
if (undistributeScList != null && undistributeScList.Count != 0)
|
{
|
roomTempList.Add(roomUn);
|
}
|
}
|
else
|
{
|
if (undistributeDevList.Count != 0)
|
{
|
roomTempList.Add(roomUn);
|
}
|
}
|
|
for (int i = 0; i < roomTempList.Count; i++)
|
{
|
var room = roomTempList[i];
|
bool canSelect = false;
|
if (curControlDev.currentSelectRoomId == room.Id)
|
{
|
slectedRoom = room;
|
canSelect = true;
|
}
|
//房间
|
var btnRoomFrameLayout = new FrameLayout
|
{
|
Height = Application.GetMinReal(159),
|
Width = Application.GetMinReal(255),
|
Y = Application.GetRealHeight(23),
|
X = Application.GetRealWidth(5),
|
BackgroundImagePath = "Item/RoomIconBackground.png",
|
BorderWidth = 1,
|
};
|
btnHorizontalScrolViewLayout.AddChidren(btnRoomFrameLayout);
|
|
var btnRoom = new Button
|
{
|
Height = Application.GetRealHeight(66),
|
Width = Application.GetRealWidth(250),
|
Y = Application.GetRealHeight(58),
|
X = Application.GetRealWidth(14),
|
Text = room.Name,
|
TextSize = 12,
|
TextColor = Shared.Common.ZigbeeColor.Current.XMGray3,
|
Gravity = Gravity.Center,
|
};
|
btnRoomFrameLayout.AddChidren(btnRoom);
|
|
btnRoom.IsSelected = false;
|
if (canSelect)
|
{
|
btnRoomFrameLayout.BackgroundImagePath = "Item/RoomIconBackgroundSelected.png";
|
btnRoom.TextColor = Shared.Common.ZigbeeColor.Current.XMWhite;
|
curentOldRoom = btnRoom;
|
curentOldRoomFrameLayout = btnRoomFrameLayout;
|
}
|
|
//被绑定的目标还未分配区域,默认是最后一个,未分配房间
|
if (string.IsNullOrEmpty(curControlDev.currentSelectRoomId))
|
{
|
if (index == roomTempList.Count - 1)
|
{
|
btnRoomFrameLayout.BackgroundImagePath = "Item/RoomIconBackgroundSelected.png";
|
btnRoom.TextColor = Shared.Common.ZigbeeColor.Current.XMWhite;
|
curentOldRoom = btnRoom;
|
curentOldRoomFrameLayout = btnRoomFrameLayout;
|
}
|
}
|
|
if (index == roomTempList.Count - 1 && index > 2)
|
{
|
var btnRoomFrameLayoutEmpty = new FrameLayout
|
{
|
Height = Application.GetMinReal(159),
|
Width = Application.GetMinReal(50),
|
Y = Application.GetRealHeight(23),
|
X = Application.GetRealWidth(5),
|
//BorderWidth = 1,
|
};
|
btnHorizontalScrolViewLayout.AddChidren(btnRoomFrameLayoutEmpty);
|
}
|
|
EventHandler<MouseEventArgs> eHandlerRoom = (sender, e) =>
|
{
|
if (!btnRoom.IsSelected)
|
{
|
if (curentOldRoom != null)
|
{
|
curentOldRoom.TextColor = Shared.Common.ZigbeeColor.Current.XMGray3;
|
}
|
curentOldRoom = btnRoom;
|
curentOldRoom.TextColor = Shared.Common.ZigbeeColor.Current.XMWhite;
|
}
|
|
if (btnRoomFrameLayout.BorderWidth == 1)
|
{
|
if (curentOldRoomFrameLayout != null)
|
{
|
curentOldRoomFrameLayout.BorderWidth = 1;
|
curentOldRoomFrameLayout.BorderColor = Shared.Common.ZigbeeColor.Current.XMOrange;
|
curentOldRoomFrameLayout.BackgroundImagePath = "Item/RoomIconBackground.png";
|
}
|
curentOldRoomFrameLayout = btnRoomFrameLayout;
|
curentOldRoomFrameLayout.BorderWidth = 0;
|
curentOldRoomFrameLayout.BackgroundImagePath = "Item/RoomIconBackgroundSelected.png";
|
}
|
curRoom = room;
|
|
//新风面板保存使能
|
btnFinifh.Enable = true;
|
btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
|
if (curBindType == 0)
|
{
|
RefreshSceneList(curRoom);
|
}
|
else
|
{
|
RefreshDeviceList(curRoom);
|
}
|
};
|
btnRoom.MouseUpEventHandler += eHandlerRoom;
|
btnRoomFrameLayout.MouseUpEventHandler += eHandlerRoom;
|
index++;
|
}
|
BindInfo.FinishDisplay(roomTempList, btnFinifh);
|
|
if (roomTempList.Count == 0)
|
{
|
curRoom = new Shared.Common.Room();
|
}
|
else
|
{
|
if (slectedRoom == null)
|
{
|
//未选中默认最后一个“未分配选中”
|
curRoom = roomTempList[index - 1];
|
var view = btnHorizontalScrolViewLayout.GetChildren(index - 1);
|
var frame = (FrameLayout)view;
|
var btn = (Button)frame.GetChildren(0);
|
frame.BackgroundImagePath = "Item/RoomIconBackgroundSelected.png";
|
btn.TextColor = Shared.Common.ZigbeeColor.Current.XMWhite;
|
curentOldRoom = btn;
|
curentOldRoomFrameLayout = frame;
|
}
|
else
|
{
|
curRoom = slectedRoom;
|
}
|
}
|
|
if (curBindType == 0)
|
{
|
RefreshSceneList(curRoom);
|
}
|
else
|
{
|
RefreshDeviceList(curRoom);
|
}
|
|
switch (curBindType)
|
{
|
case 1:
|
btnTipText.Text = MutilfunctionPanelMethod.MatchTypeBindTextTip(curBindType, MutilfunctionPanelMethod.curSwitchCount + MutilfunctionPanelMethod.curSocketCount + MutilfunctionPanelMethod.curLightFromRelayCount);
|
break;
|
case 2:
|
btnTipText.Text = MutilfunctionPanelMethod.MatchTypeBindTextTip(curBindType, MutilfunctionPanelMethod.curSwitchCount + MutilfunctionPanelMethod.curSocketCount + MutilfunctionPanelMethod.curLightFromRelayCount);
|
break;
|
case 3:
|
btnTipText.Text = MutilfunctionPanelMethod.MatchTypeBindTextTip(curBindType, MutilfunctionPanelMethod.curSwitchCount + MutilfunctionPanelMethod.curSocketCount + MutilfunctionPanelMethod.curLightFromRelayCount + MutilfunctionPanelMethod.curLightCount);
|
break;
|
default:
|
btnTipText.Text = MutilfunctionPanelMethod.MatchTypeBindTextTip(curBindType, curBindTypeList.Count);
|
break;
|
}
|
}
|
|
/// <summary>
|
/// 按键绑目标表显示
|
/// </summary>
|
/// <param name="curRoom"></param>
|
void RefreshDeviceList(Room curRoom)
|
{
|
midVerticalScrolViewLayout.RemoveAll();
|
Button oldDevice = null;
|
int curIndex = 0;
|
|
if (curRoom.Id == "UndistributedId")
|
{
|
currentRoomSupportBindDeviceList = MutilfunctionPanelMethod.GetUndistributeDeviceList(undistributeDevList, curBindTypeList, curBindType);
|
}
|
else
|
{
|
currentRoomSupportBindDeviceList = MutilfunctionPanelMethod.GetCurRoomSupportDeviceList(curRoom, currentRoomSupportBindDeviceList, curBindTypeList, curBindType);
|
}
|
|
if (currentRoomSupportBindDeviceList.Count == 0)
|
{
|
btnFinifh.Enable = false;
|
btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect;
|
return;
|
}
|
foreach (var device in currentRoomSupportBindDeviceList)
|
{
|
#region 绑定表UI显(无数据处理)
|
var rowLayout = new FrameLayout()
|
{
|
Height = Application.GetRealHeight(23 + 127),
|
BackgroundColor = Shared.Common.ZigbeeColor.Current.XMWhite,
|
};
|
midVerticalScrolViewLayout.AddChidren(rowLayout);
|
|
var devicePic = new Button()
|
{
|
X = Application.GetMinRealAverage(58),
|
Y = Application.GetMinRealAverage(46),
|
Width = Application.GetMinRealAverage(81),
|
Height = Application.GetMinRealAverage(81),
|
UnSelectedImagePath = device.IconPath,
|
};
|
rowLayout.AddChidren(devicePic);
|
|
var btnBindName = new Button()
|
{
|
Width = Application.GetRealWidth(790),
|
X = devicePic.Right + Application.GetRealWidth(20),
|
TextAlignment = TextAlignment.CenterLeft,
|
TextSize = 15,
|
Text = HdlDeviceCommonLogic.Current.GetDeviceEpointName(device),
|
};
|
rowLayout.AddChidren(btnBindName);
|
|
var btnChoose = new Button()
|
{
|
Width = Application.GetMinReal(60),
|
Height = Application.GetMinReal(60),
|
X = Application.GetRealWidth(861 + 81),
|
Y = Application.GetRealHeight(35),
|
SelectedImagePath = "DoorLock/SelectedIcon.png",
|
Visible = false,
|
};
|
rowLayout.AddChidren(btnChoose);
|
|
var line2 = new Button()
|
{
|
Y = rowLayout.Height - 1,
|
X = devicePic.Right + Application.GetRealWidth(20),
|
Width = Application.GetRealWidth(965 - 116),
|
Height = 1,
|
BackgroundColor = Shared.Common.ZigbeeColor.Current.XMRowLine,
|
};
|
rowLayout.AddChidren(line2);
|
|
if (curIndex == currentRoomSupportBindDeviceList.Count - 1)
|
{
|
line2.Visible = false;
|
}
|
if (HdlDeviceCommonLogic.Current.CheckDeviceIsOnline(device) == true)
|
{
|
btnBindName.TextColor = Shared.Common.ZigbeeColor.Current.TextBlack;
|
}
|
else
|
{
|
btnBindName.TextColor = Shared.Common.ZigbeeColor.Current.XMGray3;
|
}
|
switch (curBindType)
|
{
|
case 1:
|
devicePic.UnSelectedImagePath = "BindPic/Switch.png";
|
break;
|
case 2:
|
devicePic.UnSelectedImagePath = "Device/Socket1.png";
|
break;
|
case 3:
|
if (device.Type == DeviceType.DimmableLight)
|
{
|
devicePic.UnSelectedImagePath = "Device/Light.png";
|
}
|
if (device.Type == DeviceType.OnOffOutput)
|
{
|
devicePic.UnSelectedImagePath = "Device/RelayEpoint.png";
|
}
|
break;
|
case 4:
|
devicePic.UnSelectedImagePath = "Device/AirQualitySensorEpoint.png";
|
if (device.Type == DeviceType.WindowCoveringDevice)
|
{
|
var tempDev = device as Rollershade;
|
if (tempDev.WcdType == 4)
|
{
|
devicePic.UnSelectedImagePath = "BindPic/Curtain.png";
|
}
|
else
|
{
|
devicePic.UnSelectedImagePath = "BindPic/Roller.png";
|
}
|
}
|
break;
|
case 5:
|
devicePic.UnSelectedImagePath = "Device/AirConditionerEpoint.png";
|
break;
|
case 6:
|
devicePic.UnSelectedImagePath = "Device/FreshAirEpoint.png";
|
break;
|
}
|
#endregion
|
|
string mianKey = device.DeviceAddr + device.DeviceEpoint;
|
if (targetList.Count != 0)
|
{
|
foreach (var bindedDev in targetList)
|
{
|
if (bindedDev.DeviceAddr + bindedDev.DeviceEpoint == mianKey)
|
{
|
btnChoose.IsSelected = true;
|
btnChoose.Visible = true;
|
oldDevice = btnChoose;
|
}
|
}
|
}
|
|
EventHandler<MouseEventArgs> hander = (sender, e) =>
|
{
|
//目标备注处理
|
var localName = System.Text.Encoding.UTF8.GetBytes(HdlDeviceCommonLogic.Current.GetDeviceEpointName(device));
|
if (localName.Length > 20)
|
{
|
new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindRemarkTip2), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance);
|
return;
|
}
|
btnChoose.IsSelected = !btnChoose.IsSelected;
|
if (curBindType != 6)
|
{
|
if (curSupportBindEpointList.Count == 0)
|
{
|
new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFull), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance);
|
return;
|
}
|
if (curBindType == 3)
|
{
|
if (device.Type == DeviceType.DimmableLight)
|
{
|
if (curSupportDimmerEpointList.Count == 0)
|
{
|
new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.CanSelectRelay), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance);
|
return;
|
}
|
}
|
if (device.Type == DeviceType.OnOffOutput)
|
{
|
if (curSupportLightEpointList.Count == 0)
|
{
|
new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.CanSelectDimmer), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance);
|
return;
|
}
|
}
|
}
|
if (!btnChoose.IsSelected)
|
{
|
targetList.Remove(device);
|
btnChoose.IsSelected = false;
|
btnChoose.Visible = false;
|
}
|
else
|
{
|
if (targetList.Count >= curSupportBindEpointList.Count)
|
{
|
new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFull), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance);
|
}
|
else
|
{
|
if (curBindType == 3)
|
{
|
//临时记录灯光类型中调光个数和开关个数
|
var tList1 = new List<CommonDevice> { };
|
var tList2 = new List<CommonDevice> { };
|
foreach (var tD in targetList)
|
{
|
if (tD.Type == DeviceType.DimmableLight)
|
{
|
tList1.Add(tD);
|
}
|
if (tD.Type == DeviceType.OnOffOutput)
|
{
|
tList2.Add(tD);
|
}
|
}
|
if (device.Type == DeviceType.DimmableLight)
|
{
|
if (tList1.Count >= curSupportDimmerEpointList.Count)
|
{
|
new Tip() { MaxWidth = 310, Text = Language.StringByID(R.MyInternationalizationString.CanSelectRelay), Direction = AMPopTipDirection.None, CloseTime = 2 }.Show(Common.CommonPage.Instance);
|
return;
|
}
|
}
|
if (device.Type == DeviceType.OnOffOutput)
|
{
|
if (tList2.Count >= curSupportLightEpointList.Count)
|
{
|
new Tip() { MaxWidth = 310, Text = Language.StringByID(R.MyInternationalizationString.CanSelectDimmer), Direction = AMPopTipDirection.None, CloseTime = 2 }.Show(Common.CommonPage.Instance);
|
return;
|
}
|
}
|
}
|
|
targetList.Add(device);
|
btnChoose.IsSelected = true;
|
btnChoose.Visible = true;
|
}
|
}
|
}
|
else
|
{
|
if (curSupportBindEpointList.Count == 0)
|
{
|
new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFull), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance);
|
return;
|
}
|
if (!btnChoose.IsSelected)
|
{
|
if (oldDevice != null)
|
{
|
oldDevice.IsSelected = false;
|
oldDevice.Visible = false;
|
}
|
oldDevice = btnChoose;
|
oldDevice.IsSelected = false;
|
oldDevice.Visible = false;
|
targetList.Clear();
|
}
|
else
|
{
|
if (oldDevice != null)
|
{
|
oldDevice.IsSelected = false;
|
oldDevice.Visible = false;
|
}
|
oldDevice = btnChoose;
|
oldDevice.IsSelected = true;
|
oldDevice.Visible = true;
|
targetList.Clear();
|
targetList.Add(device);
|
}
|
}
|
if (targetList.Count == 0)
|
{
|
btnFinifh.Enable = false;
|
btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect;
|
}
|
else
|
{
|
btnFinifh.Enable = true;
|
btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
|
}
|
};
|
rowLayout.MouseUpEventHandler += hander;
|
devicePic.MouseUpEventHandler += hander;
|
btnBindName.MouseUpEventHandler += hander;
|
btnChoose.MouseUpEventHandler += hander;
|
curIndex++;
|
}
|
}
|
|
/// <summary>
|
/// 按键绑目标表显示
|
/// </summary>
|
/// <param name="curRoom"></param>
|
void RefreshSceneList(Room curRoom)
|
{
|
midVerticalScrolViewLayout.RemoveAll();
|
Button oldScene = null;
|
int curIndex = 0;
|
|
if (curRoom.Id == "UndistributedId")
|
{
|
currentRoomSupportBindSceneList = HdlSceneLogic.Current.GetUnalloctedScenes();
|
}
|
else
|
{
|
currentRoomSupportBindSceneList = MutilfunctionPanelMethod.GetCurRoomSupportSceneList(curRoom, currentRoomSupportBindSceneList, curBindTypeList);
|
}
|
|
if (currentRoomSupportBindSceneList.Count == 0)
|
{
|
btnFinifh.Enable = false;
|
btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect;
|
return;
|
}
|
foreach (var scene in currentRoomSupportBindSceneList)
|
{
|
#region 绑定表UI显(无数据处理)
|
var rowLayout = new FrameLayout()
|
{
|
Height = Application.GetRealHeight(23 + 127),
|
BackgroundColor = Shared.Common.ZigbeeColor.Current.XMWhite,
|
};
|
midVerticalScrolViewLayout.AddChidren(rowLayout);
|
|
var devicePic = new Button()
|
{
|
X = Application.GetMinRealAverage(58),
|
Y = Application.GetMinRealAverage(46),
|
Width = Application.GetMinRealAverage(81),
|
Height = Application.GetMinRealAverage(81),
|
UnSelectedImagePath = "Scene/SceneIcon.png",
|
};
|
rowLayout.AddChidren(devicePic);
|
|
var btnBindName = new Button()
|
{
|
Width = Application.GetRealWidth(790),
|
X = devicePic.Right + Application.GetRealWidth(20),
|
TextAlignment = TextAlignment.CenterLeft,
|
TextSize = 15,
|
TextColor = Shared.Common.ZigbeeColor.Current.TextBlack,
|
Text = scene.Name,
|
};
|
rowLayout.AddChidren(btnBindName);
|
|
var btnChoose = new Button()
|
{
|
Width = Application.GetMinReal(60),
|
Height = Application.GetMinReal(60),
|
X = Application.GetRealWidth(861 + 81),
|
Y = Application.GetRealHeight(35),
|
SelectedImagePath = "DoorLock/SelectedIcon.png",
|
Visible = false,
|
};
|
rowLayout.AddChidren(btnChoose);
|
|
var line2 = new Button()
|
{
|
Y = rowLayout.Height - 1,
|
X = devicePic.Right + Application.GetRealWidth(20),
|
Width = Application.GetRealWidth(965 - 116),
|
Height = 1,
|
BackgroundColor = Shared.Common.ZigbeeColor.Current.XMRowLine,
|
};
|
rowLayout.AddChidren(line2);
|
|
if (curIndex == currentRoomSupportBindDeviceList.Count - 1)
|
{
|
line2.Visible = false;
|
}
|
#endregion
|
|
if (targetScList.Count != 0)
|
{
|
foreach (var bindedDev in targetScList)
|
{
|
if (bindedDev.Id == scene.Id)
|
{
|
btnChoose.IsSelected = true;
|
btnChoose.Visible = true;
|
oldScene = btnChoose;
|
}
|
}
|
}
|
|
EventHandler<MouseEventArgs> hander = (sender, e) =>
|
{
|
|
//目标备注处理
|
if (!string.IsNullOrEmpty(scene.Name))
|
{
|
var localName = System.Text.Encoding.UTF8.GetBytes(scene.Name);
|
if (localName.Length > 20)
|
{
|
new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindRemarkTip2), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance);
|
return;
|
}
|
}
|
|
btnChoose.IsSelected = !btnChoose.IsSelected;
|
|
if (curSupportBindEpointList.Count == 0)
|
{
|
new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFull), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance);
|
return;
|
}
|
|
if (!btnChoose.IsSelected)
|
{
|
targetScList.Remove(scene);
|
btnChoose.IsSelected = false;
|
btnChoose.Visible = false;
|
}
|
else
|
{
|
if (targetScList.Count >= curSupportBindEpointList.Count)
|
{
|
new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFull), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance);
|
}
|
else
|
{
|
targetScList.Add(scene);
|
btnChoose.IsSelected = true;
|
btnChoose.Visible = true;
|
}
|
}
|
|
if (targetScList.Count == 0)
|
{
|
btnFinifh.Enable = false;
|
btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect;
|
}
|
else
|
{
|
btnFinifh.Enable = true;
|
btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
|
}
|
};
|
rowLayout.MouseUpEventHandler += hander;
|
devicePic.MouseUpEventHandler += hander;
|
btnBindName.MouseUpEventHandler += hander;
|
btnChoose.MouseUpEventHandler += hander;
|
curIndex++;
|
}
|
}
|
#endregion
|
|
#region 数据处理
|
/// <summary>
|
/// 初始化设备数据
|
/// </summary>
|
void InitData()
|
{
|
System.Threading.Tasks.Task.Run(async () =>
|
{
|
try
|
{
|
//获取楼层
|
dicFloorList = HdlRoomLogic.Current.GetFloorSortList();
|
curControlDev.currentSelectFloorId = BindInfo.GetCurrentSelectFloorId();
|
|
//获取房间列表
|
supportRoomList = BindInfo.GetSupportRoomList();
|
|
//获取面板已经绑定的匹配类型的列表
|
curBindTypeList = MutilfunctionPanelMethod.GetMatchBindList(curControlDev, curBindType);
|
|
if (curBindType == 0)
|
{
|
currentPanelSupportBindSceneList = MutilfunctionPanelMethod.GetAllRoomSupportSceneList(currentPanelSupportBindSceneList, supportRoomList, curBindTypeList);
|
// 获取本地未分配的支持当前类型的绑定场景列表
|
undistributeScList = HdlSceneLogic.Current.GetUnalloctedScenes();
|
}
|
else
|
{
|
//获取所有房间中匹配的能绑的目
|
currentPanelSupportBindDeviceList = MutilfunctionPanelMethod.GetAllRoomSupportDeviceList(currentPanelSupportBindDeviceList, supportRoomList, curBindTypeList, curBindType);
|
//获取本地未分配的支持当前类型的绑定设备列表
|
undistributeDevList = MutilfunctionPanelMethod.GetUndistributeDeviceList(undistributeDevList, curBindTypeList, curBindType);
|
}
|
//获取当前支持的端点绑定表
|
curSupportBindEpointList = MutilfunctionPanelMethod.GetMatchEpointList(curControlDev, curBindType);
|
if (curBindType == 3)
|
{
|
foreach (var ep in curSupportBindEpointList)
|
{
|
if (ep >= 22 && ep <= 28)
|
{
|
curSupportDimmerEpointList.Add(ep);
|
}
|
if (ep >= 52 && ep <= 61)
|
{
|
curSupportLightEpointList.Add(ep);
|
}
|
}
|
}
|
}
|
catch (Exception ex)
|
{
|
var mess = ex.Message;
|
}
|
finally
|
{
|
Application.RunOnMainThread(() =>
|
{
|
if (!canFresh)
|
{
|
BindDownFrameLayout(this.midFrameLayout, curControlDev, dicFloorList, ref btnFloorText);
|
}
|
ChooseFloorAction += (floorId, btnMethodText) =>
|
{
|
btnFloorText.Text = dicFloorList[floorId];
|
|
//获取房间列表
|
supportRoomList.Clear();
|
supportRoomList = BindInfo.GetSupportRoomList();
|
if (curBindType == 0)
|
{
|
// 获取本地未分配的支持当前类型的绑定场景列表
|
undistributeScList = HdlSceneLogic.Current.GetUnalloctedScenes();
|
}
|
else
|
{
|
//获取本地未分配的支持当前类型的绑定设备列表
|
undistributeDevList = MutilfunctionPanelMethod.GetUndistributeDeviceList(undistributeDevList, curBindTypeList, curBindType);
|
}
|
RefreshRoomList();
|
};
|
//默认楼层显示
|
if (BindInfo.GetCurrentSelectFloorIdName() != null)
|
{
|
Application.RunOnMainThread(() =>
|
{
|
btnFloorText.Text = BindInfo.GetCurrentSelectFloorIdName();
|
});
|
}
|
//获取楼层中房间列表
|
RefreshRoomList();
|
CommonPage.Loading.Hide();
|
canFresh = false;
|
midVerticalScrolViewLayout.EndHeaderRefreshing();
|
});
|
}
|
});
|
}
|
|
/// <summary>
|
/// 保存目标
|
/// </summary>
|
/// <param name="curControlDev"></param>
|
void SaveTarget()
|
{
|
btnFinifh.Enable = false;
|
btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect;
|
System.Threading.Tasks.Task.Run(() =>
|
{
|
try
|
{
|
Application.RunOnMainThread(() =>
|
{
|
CommonPage.Loading.Start("");
|
});
|
int tempBindCluster = -1;
|
int targetSendCount = 0;
|
int targetRecCount = 0;
|
if (curBindType == 0)
|
{
|
targetSendCount = targetScList.Count;
|
if (targetScList.Count == 0)
|
{
|
//没有目标提示
|
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;
|
}
|
for (int i = 0; i < targetScList.Count; i++)
|
{
|
//绑定新的数据
|
var addSingleBindData = new AddSingleBindData();
|
addSingleBindData.DeviceAddr = curControlDev.DeviceAddr;
|
for (int j = 0; j < curSupportBindEpointList.Count; j++)
|
{
|
curSendEpointList.Add(curSupportBindEpointList[0]);
|
addSingleBindData.Epoint = curControlDev.DeviceEpoint = curSupportBindEpointList[0];
|
break;
|
}
|
var de = targetScList[i];
|
addSingleBindData.BindType = 1;
|
addSingleBindData.BindClusterList.Add(6);
|
addSingleBindData.BindScenesId = de.Id;
|
|
var resT = AddDeviceBind(addSingleBindData, targetSendCount, ref targetRecCount);
|
if (!resT)
|
{
|
break;
|
}
|
}
|
}
|
else
|
{
|
targetSendCount = targetList.Count;
|
if (targetList.Count == 0)
|
{
|
//没有目标提示
|
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;
|
}
|
foreach (var de in targetList)
|
{
|
//绑定新的数据
|
var addSingleBindData = new AddSingleBindData();
|
addSingleBindData.DeviceAddr = curControlDev.DeviceAddr;
|
|
if (curBindType == 3)
|
{
|
if (de.Type == DeviceType.DimmableLight)
|
{
|
for (int j = 0; j < curSupportDimmerEpointList.Count; j++)
|
{
|
curSendEpointList.Add(curSupportDimmerEpointList[0]);
|
addSingleBindData.Epoint = curControlDev.DeviceEpoint = curSupportDimmerEpointList[0];
|
break;
|
}
|
}
|
|
if (de.Type == DeviceType.OnOffOutput)
|
{
|
for (int j = 0; j < curSupportLightEpointList.Count; j++)
|
{
|
curSendEpointList.Add(curSupportLightEpointList[0]);
|
addSingleBindData.Epoint = curControlDev.DeviceEpoint = curSupportLightEpointList[0];
|
break;
|
}
|
}
|
}
|
else
|
{
|
for (int j = 0; j < curSupportBindEpointList.Count; j++)
|
{
|
curSendEpointList.Add(curSupportBindEpointList[0]);
|
addSingleBindData.Epoint = curControlDev.DeviceEpoint = curSupportBindEpointList[0];
|
break;
|
}
|
}
|
|
addSingleBindData.BindType = 0;
|
addSingleBindData.BindMacAddr = de.DeviceAddr;
|
addSingleBindData.BindEpoint = de.DeviceEpoint;
|
switch (curBindType)
|
{
|
case 0:
|
case 1:
|
case 2:
|
addSingleBindData.BindClusterList.Add(6);
|
break;
|
case 3:
|
addSingleBindData.BindClusterList.Add(6);
|
var device = HdlDeviceCommonLogic.Current.GetDevice(de.DeviceAddr, de.DeviceEpoint);
|
if (device != null)
|
{
|
if (device.Type == DeviceType.DimmableLight)
|
{
|
//灯光为调光时需要绑定6,8
|
addSingleBindData.BindClusterList.Add(8);
|
}
|
}
|
break;
|
case 4:
|
addSingleBindData.BindClusterList.Add(258);
|
break;
|
case 5:
|
//要绑定空调:需要绑定513,514
|
addSingleBindData.BindClusterList.Add(513);
|
addSingleBindData.BindClusterList.Add(514);
|
break;
|
case 6:
|
addSingleBindData.BindClusterList.Add(514);
|
break;
|
}
|
|
|
var resT = AddDeviceBind(addSingleBindData, targetSendCount, ref targetRecCount);
|
if (!resT)
|
{
|
break;
|
}
|
}
|
}
|
}
|
catch
|
{
|
Application.RunOnMainThread(() =>
|
{
|
btnFinifh.Enable = true;
|
btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
|
CommonPage.Loading.Hide();
|
});
|
}
|
|
});
|
}
|
|
/// <summary>
|
/// AddDeviceBind
|
/// </summary>
|
/// <param name="addSingleBindData"></param>
|
/// <param name="targetSendCount"></param>
|
/// <param name="targetRecCount"></param>
|
/// <returns></returns>
|
private bool AddDeviceBind(AddSingleBindData addSingleBindData, int targetSendCount, ref int targetRecCount)
|
{
|
var addSuccess = false;
|
var dev = HdlDeviceBindLogic.Current.AddDeviceSingleBindAsync(addSingleBindData);
|
if (dev != null && dev.addedDeviceSingleBindResponseData != null)
|
{
|
addSuccess = true;
|
targetRecCount++;
|
if (dev.addedDeviceSingleBindResponseData.Result == 0)
|
{
|
var countTotal = targetRecCount;
|
var bList = new List<BindListAllInfo>();
|
foreach (var cluster in dev.addedDeviceSingleBindResponseData.BindClusterList)
|
{
|
var curD = new BindListAllInfo();
|
curD.KeyMacAddr = curControlDev.DeviceAddr;
|
curD.KeyEpoint = curControlDev.DeviceEpoint;
|
curD.BindCluster = cluster;
|
curD.BindScenesId = dev.addedDeviceSingleBindResponseData.BindScenesId;
|
curD.BindMacAddr = dev.addedDeviceSingleBindResponseData.BindMacAddr;
|
curD.BindEpoint = dev.addedDeviceSingleBindResponseData.BindEpoint;
|
curD.ESName = dev.addedDeviceSingleBindResponseData.ESName;
|
curD.BindType = dev.addedDeviceSingleBindResponseData.BindType;
|
bList.Add(curD);
|
}
|
|
if (curControlDev.bindTargetsFromMutilfunctionPanelList.ContainsKey(curControlDev.DeviceAddr + curControlDev.DeviceEpoint))
|
{
|
curControlDev.bindTargetsFromMutilfunctionPanelList[curControlDev.DeviceAddr + curControlDev.DeviceEpoint] = bList;
|
}
|
else
|
{
|
curControlDev.bindTargetsFromMutilfunctionPanelList.Add(curControlDev.DeviceAddr + curControlDev.DeviceEpoint, bList);
|
}
|
|
if (curBindType == 3)
|
{
|
if (addSingleBindData.Epoint >= 22 && addSingleBindData.Epoint <= 28)
|
{
|
curSupportDimmerEpointList.RemoveAt(0);
|
|
}
|
if (addSingleBindData.Epoint >= 52 && addSingleBindData.Epoint <= 61)
|
{
|
curSupportLightEpointList.RemoveAt(0);
|
}
|
}
|
else
|
{
|
curSupportBindEpointList.RemoveAt(0);
|
}
|
Application.RunOnMainThread(() =>
|
{
|
if (countTotal == targetSendCount)
|
{
|
if (actionRefreshBindList != null)
|
{
|
actionRefreshBindList();
|
}
|
targetList.Clear();
|
this.RemoveFromParent();
|
btnFinifh.Enable = true;
|
btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
|
CommonPage.Loading.Hide();
|
}
|
});
|
}
|
else if (dev.addedDeviceSingleBindResponseData.Result == 1)
|
{
|
Application.RunOnMainThread(() =>
|
{
|
btnFinifh.Enable = true;
|
btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
|
RefreshRoomList();
|
CommonPage.Loading.Hide();
|
new Tip()
|
{
|
MaxWidth = 150,
|
Text = Language.StringByID(R.MyInternationalizationString.BindFailed) + "(" + "5020_1" + ")",
|
Direction = AMPopTipDirection.Up,
|
CloseTime = 1
|
}.Show(btnFinifh);
|
});
|
}
|
else
|
{
|
Application.RunOnMainThread(() =>
|
{
|
btnFinifh.Enable = true;
|
btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
|
RefreshRoomList();
|
CommonPage.Loading.Hide();
|
new Tip()
|
{
|
MaxWidth = 150,
|
Text = Language.StringByID(R.MyInternationalizationString.BindUnknownError) + "(" + "5020_2" + ")",
|
Direction = AMPopTipDirection.Up,
|
CloseTime = 1
|
}.Show(btnFinifh);
|
});
|
}
|
}
|
else
|
{
|
Application.RunOnMainThread(() =>
|
{
|
btnFinifh.Enable = true;
|
btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
|
RefreshRoomList();
|
new Tip()
|
{
|
MaxWidth = 150,
|
Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime) + "(" + "5020" + ")",
|
Direction = AMPopTipDirection.Up,
|
CloseTime = 1
|
}.Show(btnFinifh);
|
CommonPage.Loading.Hide();
|
GetEpointData();
|
});
|
}
|
return addSuccess;
|
}
|
|
/// <summary>
|
/// 初始化设备数据
|
/// </summary>
|
void GetEpointData()
|
{
|
System.Threading.Tasks.Task.Run(() =>
|
{
|
try
|
{
|
Application.RunOnMainThread(() =>
|
{
|
CommonPage.Loading.Start("");
|
});
|
int count1 = curSendEpointList.Count;
|
int count2 = 0;
|
foreach (var epoint in curSendEpointList)
|
{
|
curControlDev.DeviceEpoint = epoint;
|
var getBindList = HdlDeviceBindLogic.Current.GetDeviceBindAsync(curControlDev);
|
if (getBindList != null && getBindList.getAllBindResponseData != null)
|
{
|
count2++;
|
var bList = new List<BindListAllInfo>();
|
foreach (var dev in getBindList.getAllBindResponseData.BindList)
|
{
|
var curD = new BindListAllInfo();
|
curD.KeyMacAddr = curControlDev.DeviceAddr;
|
curD.KeyEpoint = epoint;
|
curD.BindCluster = dev.BindCluster;
|
curD.BindScenesId = dev.BindScenesId;
|
curD.BindMacAddr = dev.BindMacAddr;
|
curD.BindEpoint = dev.BindEpoint;
|
curD.BindType = dev.BindType;
|
bList.Add(curD);
|
|
//更新targetScListj or targetList
|
if (curBindType == 0)
|
{
|
for (int i = 0; i < targetScList.Count; i++)
|
{
|
if (targetScList[i].Id == dev.BindScenesId)
|
{
|
targetScList.RemoveAt(i);
|
}
|
}
|
}
|
else
|
{
|
for (int i = 0; i < targetList.Count; i++)
|
{
|
if (targetList[i].DeviceAddr + targetList[i].DeviceEpoint == dev.BindMacAddr + dev.BindEpoint)
|
{
|
targetList.RemoveAt(i);
|
}
|
}
|
}
|
}
|
|
//更新bindTargetsFromMutilfunctionPanelList
|
if (curControlDev.bindTargetsFromMutilfunctionPanelList.ContainsKey(curControlDev.DeviceAddr + curControlDev.DeviceEpoint))
|
{
|
curControlDev.bindTargetsFromMutilfunctionPanelList[curControlDev.DeviceAddr + curControlDev.DeviceEpoint] = bList;
|
}
|
else
|
{
|
curControlDev.bindTargetsFromMutilfunctionPanelList.Add(curControlDev.DeviceAddr + curControlDev.DeviceEpoint, bList);
|
}
|
|
//更新当前支持的端点绑定表
|
curSupportBindEpointList = MutilfunctionPanelMethod.GetMatchEpointList(curControlDev, curBindType);
|
if (curBindType == 3)
|
{
|
foreach (var ep in curSupportBindEpointList)
|
{
|
if (ep >= 22 && ep <= 28)
|
{
|
curSupportDimmerEpointList.Remove(ep);
|
}
|
if (ep >= 52 && ep <= 61)
|
{
|
curSupportLightEpointList.Remove(ep);
|
}
|
}
|
}
|
|
if (count1 == count2)
|
{
|
Application.RunOnMainThread(() =>
|
{
|
if (actionRefreshBindList != null)
|
{
|
actionRefreshBindList();
|
}
|
RefreshRoomList();
|
CommonPage.Loading.Hide();
|
});
|
}
|
}
|
else
|
{
|
Application.RunOnMainThread(() =>
|
{
|
targetList.Clear();
|
new Tip() { MaxWidth = 300, Text = Language.StringByID(R.MyInternationalizationString.UpdateBindList), Direction = AMPopTipDirection.None, CloseTime = 3 }.Show(Common.CommonPage.Instance);
|
btnFinifh.Enable = true;
|
btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack;
|
CommonPage.Loading.Hide();
|
this.RemoveFromParent();
|
});
|
break;
|
}
|
}
|
}
|
catch { }
|
});
|
}
|
#endregion
|
}
|
}
|