old mode 100755
new mode 100644
| | |
| | | /// <summary> |
| | | /// 按键配置的目标列表 |
| | | /// </summary> |
| | | List<CommonDevice> targetList = new List<CommonDevice>(); |
| | | List<CommonDevice> targetListDevice = new List<CommonDevice>();
|
| | | /// <summary> |
| | | /// 按键配置的场景目标列表 |
| | | /// </summary> |
| | | List<SceneUI> targetListScene = new List<SceneUI>(); |
| | | /// <summary> |
| | | /// 本地房间列表 |
| | | /// </summary> |
| | |
| | | var sc = currentKey.bindList.Find(obj => (obj != null) && (obj.BindScenesId == scTemp.Id)); |
| | | if (sc != null) |
| | | { |
| | | targetList.Add(scTemp); |
| | | targetListScene.Add(scTemp); |
| | | } |
| | | } |
| | | } |
| | |
| | | btnFinifh.Enable = true; |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | } |
| | | if (targetList.Count == 0) |
| | | if (targetListDevice.Count == 0 && targetListScene.Count == 0) |
| | | { |
| | | btnFinifh.Enable = false; |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect; |
| | |
| | | bool isFinish = false; |
| | | try |
| | | { |
| | | if (targetList.Count == 0) |
| | | if (targetListDevice.Count == 0 && targetListScene.Count == 0) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | |
| | | var addBindeDev = new AddBindData(); |
| | | addBindeDev.DeviceAddr = currentKey.DeviceAddr; |
| | | addBindeDev.Epoint = currentKey.DeviceEpoint; |
| | | foreach (var de in targetList) |
| | | foreach (var de in targetListDevice) |
| | | { |
| | | if (de.DeviceAddr != null) |
| | | { |
| | |
| | | addBindInfo.BindEpoint = de.DeviceEpoint; |
| | | addBindeDev.BindList.Add(addBindInfo); |
| | | } |
| | | else |
| | | { |
| | | var addBindInfo = new AddBindListObj(); |
| | | addBindInfo.BindType = 1; |
| | | addBindInfo.BindCluster = 6; |
| | | var sc1 = (SceneUI)de; |
| | | addBindInfo.BindScenesId = sc1.Id; |
| | | addBindeDev.BindList.Add(addBindInfo); |
| | | } |
| | | }
|
| | | foreach (var de in targetListScene) |
| | | {
|
| | | var addBindInfo = new AddBindListObj();
|
| | | addBindInfo.BindType = 1;
|
| | | addBindInfo.BindCluster = 6;
|
| | | addBindInfo.BindScenesId = de.Id;
|
| | | addBindeDev.BindList.Add(addBindInfo); |
| | | } |
| | | |
| | | var dev = new AddedDeviceBindResponseAllData(); |
| | |
| | | if (dev.addedDeviceBindResponseData.Result == 0) |
| | | { |
| | | currentKey.bindList = dev.addedDeviceBindResponseData.BindList; |
| | | targetList.Clear(); |
| | | targetListDevice.Clear(); |
| | | targetListScene.Clear(); |
| | | isFinish = true; |
| | | if (isFinish) |
| | | { |
| | |
| | | { |
| | | roomTempList.Add(room); |
| | | } |
| | | if (roomTempList.Count != 0) |
| | | { |
| | | curRoom = roomTempList[0]; |
| | | } |
| | | |
| | | } |
| | | for (int i = 0; i < roomTempList.Count; i++) |
| | | { |
| | | var room = roomTempList[i]; |
| | | curRoom = roomTempList[0]; |
| | | var btnRoomFrameLayout = new FrameLayout |
| | | { |
| | | Height = Application.GetMinReal(159), |
| | |
| | | curentOldRoom = btnRoom; |
| | | curentOldRoomFrameLayout = btnRoomFrameLayout; |
| | | } |
| | | |
| | | if (index == roomTempList.Count - 1 && index > 3) |
| | | { |
| | | 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) |
| | |
| | | curentOldRoomFrameLayout.BackgroundImagePath = "Item/RoomIconBackgroundSelected.png"; |
| | | } |
| | | curRoom = room; |
| | | currentKey.RoomId = room.Id; |
| | | if (curRoom.ListSceneId.Count == 0) |
| | | { |
| | | btnFinifh.Enable = false; |
| | |
| | | btnFinifh.Enable = true; |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | } |
| | | if (targetList.Count == 0) |
| | | if (targetListDevice.Count == 0 && targetListScene.Count == 0) |
| | | { |
| | | btnFinifh.Enable = false; |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect; |
| | |
| | | { |
| | | btnBindName.Text = scene.Name; |
| | | } |
| | | if (targetList.Count == 0) |
| | | if (targetListDevice.Count == 0 && targetListScene.Count == 0) |
| | | { |
| | | foreach (var bindedSc in currentKey.bindList) |
| | | { |
| | |
| | | btnChoose.IsSelected = true; |
| | | btnChoose.Visible = true; |
| | | oldScene = btnChoose; |
| | | targetList.Add(scene); |
| | | targetListScene.Add(scene); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | foreach (var bindedSc in targetList) |
| | | foreach (var bindedSc in targetListScene) |
| | | { |
| | | var sc1 = (SceneUI)bindedSc; |
| | | if (scene.Id == sc1.Id) |
| | | if (scene.Id == bindedSc.Id) |
| | | { |
| | | btnChoose.IsSelected = true; |
| | | btnChoose.Visible = true; |
| | |
| | | } |
| | | } |
| | | |
| | | bool IsTip = false; |
| | | EventHandler<MouseEventArgs> hander = (sender, e) => |
| | | { |
| | | if (currentKey.bindList.Count != 0) |
| | | { |
| | | if (IsTip) |
| | | { |
| | | return; |
| | | } |
| | | IsTip = true; |
| | | if (btnChoose.IsSelected) |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindExist), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnBindName); |
| | | return; |
| | | } |
| | | } |
| | | { |
| | | if (currentKey.bindList.Count != 0) |
| | | { |
| | | if (btnChoose.IsSelected) |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindExist), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnBindName); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | if (!btnChoose.IsSelected) |
| | | { |
| | | if (oldScene != null) |
| | | { |
| | | oldScene.IsSelected = false; |
| | | oldScene.Visible = false; |
| | | } |
| | | oldScene = btnChoose; |
| | | oldScene.IsSelected = true; |
| | | oldScene.Visible = true; |
| | | currentKey.curSelectSceneID = scene.Id.ToString(); |
| | | targetList.Clear(); |
| | | targetList.Add(scene); |
| | | } |
| | | 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; |
| | | } |
| | | }; |
| | | if (!btnChoose.IsSelected) |
| | | { |
| | | if (oldScene != null) |
| | | { |
| | | oldScene.IsSelected = false; |
| | | oldScene.Visible = false; |
| | | } |
| | | oldScene = btnChoose; |
| | | oldScene.IsSelected = true; |
| | | oldScene.Visible = true; |
| | | targetListDevice.Clear(); |
| | | targetListScene.Clear(); |
| | | targetListScene.Add(scene); |
| | | } |
| | | if (targetListDevice.Count == 0 && targetListScene.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++; |
| | | } |
| | | if (targetList.Count == 0) |
| | | if (targetListDevice.Count == 0 && targetListScene.Count == 0) |
| | | { |
| | | btnFinifh.Enable = false; |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect; |
| | |
| | | int index = 0; |
| | | RefreshRoomList(curRoom, ref index); |
| | | RefreshSceneList(roomList[0]); |
| | | if (targetList.Count == 0) |
| | | if (targetListDevice.Count == 0 && targetListScene.Count == 0) |
| | | { |
| | | btnFinifh.Enable = false; |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect; |