| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using Microsoft.AppCenter.Crashes; |
| | | using Shared.Common; |
| | | using Shared.Phone.UserCenter.Device; |
| | | using ZigBee.Device; |
| | | using static ZigBee.Device.BindObj; |
| | | using static ZigBee.Device.Panel; |
| | | |
| | | namespace Shared.Phone.UserCenter.DeviceBind |
| | | { |
| | | /// <summary> |
| | | /// 普通面板的绑定场景界面【只可绑定1个场景】 |
| | | /// </summary> |
| | | public class AddScenePage : BindCommonLayout |
| | | { |
| | | /// 构造函数 |
| | |
| | | /// <summary> |
| | | /// 保存完成按钮 |
| | | /// </summary> |
| | | Button btnFinifh; |
| | | Button btnFinish; |
| | | /// <summary> |
| | | /// 楼层文本 |
| | | /// </summary> |
| | |
| | | }; |
| | | this.midFrameLayout.AddChidren(bottomFrameLayout); |
| | | |
| | | btnFinifh = new Button() |
| | | btnFinish = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(907), |
| | | Gravity = Gravity.CenterHorizontal, |
| | |
| | | IsBold = true, |
| | | TextSize = 16, |
| | | }; |
| | | bottomFrameLayout.AddChidren(btnFinifh); |
| | | bottomFrameLayout.AddChidren(btnFinish); |
| | | #endregion |
| | | |
| | | #region 数据处理 |
| | | #region 数据处理 |
| | | //获取楼层 |
| | | dicFloor = HdlRoomLogic.Current.GetFloorSortList(); |
| | | currentKey.currentSelectFloorId = BindInfo.GetCurrentSelectFloorId(); |
| | |
| | | |
| | | if (curRoom.ListSceneId.Count == 0) |
| | | { |
| | | btnFinifh.Enable = false; |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect; |
| | | btnFinish.Enable = false; |
| | | btnFinish.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect; |
| | | } |
| | | else |
| | | { |
| | | btnFinifh.Enable = true; |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | btnFinish.Enable = true; |
| | | btnFinish.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | } |
| | | if (targetListDevice.Count == 0 && targetListScene.Count == 0) |
| | | { |
| | | btnFinifh.Enable = false; |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect; |
| | | btnFinish.Enable = false; |
| | | btnFinish.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect; |
| | | } |
| | | else |
| | | { |
| | | btnFinifh.Enable = true; |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | btnFinish.Enable = true; |
| | | btnFinish.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | } |
| | | btnFinifh.MouseUpEventHandler += (sender, e) => |
| | | btnFinish.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | bool isFinish = false; |
| | | System.Threading.Tasks.Task.Run(() => |
| | |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btnFinifh.Enable = true; |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFailed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinifh); |
| | | btnFinish.Enable = true; |
| | | btnFinish.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFailed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinish); |
| | | CommonPage.Loading.Hide(); |
| | | }); |
| | | return; |
| | |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btnFinifh.Enable = true; |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | btnFinish.Enable = true; |
| | | btnFinish.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | CommonPage.Loading.Hide(); |
| | | var myTip = new Tip(); |
| | | myTip.Direction = AMPopTipDirection.None; |
| | | myTip.CloseTime = 2; |
| | | myTip.Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime); |
| | | myTip.Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime) + "(" + "5006" + ")"; |
| | | myTip.Show(Common.CommonPage.Instance); |
| | | }); |
| | | return; |
| | |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btnFinifh.Enable = true; |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | btnFinish.Enable = true; |
| | | btnFinish.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | CommonPage.Loading.Hide(); |
| | | var myTip = new Tip(); |
| | | myTip.Direction = AMPopTipDirection.None; |
| | | myTip.CloseTime = 2; |
| | | myTip.Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime); |
| | | myTip.Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime) + "(" + "120_ 6533" + ")"; |
| | | myTip.Show(Common.CommonPage.Instance); |
| | | }); |
| | | return; |
| | |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btnFinifh.Enable = true; |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | btnFinish.Enable = true; |
| | | btnFinish.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | var myTip = new Tip(); |
| | | myTip.Direction = AMPopTipDirection.None; |
| | | myTip.CloseTime = 2; |
| | |
| | | this.RemoveFromParent(); |
| | | } |
| | | CommonPage.Loading.Hide(); |
| | | btnFinifh.Enable = true; |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | btnFinish.Enable = true; |
| | | btnFinish.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | }); |
| | | } |
| | | else if (dev.addedDeviceBindResponseData.Result == 1) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btnFinifh.Enable = true; |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | btnFinish.Enable = true; |
| | | btnFinish.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | CommonPage.Loading.Hide(); |
| | | new Tip() |
| | | { |
| | |
| | | Text = Language.StringByID(R.MyInternationalizationString.BindFailed), |
| | | Direction = AMPopTipDirection.Up, |
| | | CloseTime = 1 |
| | | }.Show(btnFinifh); |
| | | }.Show(btnFinish); |
| | | }); |
| | | return; |
| | | } |
| | |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btnFinifh.Enable = true; |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | btnFinish.Enable = true; |
| | | btnFinish.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | CommonPage.Loading.Hide(); |
| | | new Tip() |
| | | { |
| | |
| | | Text = Language.StringByID(R.MyInternationalizationString.BindUnknownError), |
| | | Direction = AMPopTipDirection.Up, |
| | | CloseTime = 1 |
| | | }.Show(btnFinifh); |
| | | }.Show(btnFinish); |
| | | }); |
| | | |
| | | return; |
| | |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btnFinifh.Enable = true; |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | btnFinish.Enable = true; |
| | | btnFinish.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | CommonPage.Loading.Hide(); |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinifh); |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime) + "(" + "5001" + ")", Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinish); |
| | | }); |
| | | |
| | | return; |
| | |
| | | var btnRoom = new Button |
| | | { |
| | | Height = Application.GetRealHeight(58), |
| | | Width = Application.GetRealWidth(127), |
| | | Width = Application.GetRealWidth(255), |
| | | Y = Application.GetRealHeight(58), |
| | | X = Application.GetRealWidth(14), |
| | | Text = room.Name, |
| | |
| | | curentOldRoomFrameLayout = btnRoomFrameLayout; |
| | | } |
| | | |
| | | if (index == roomTempList.Count - 1 && index > 3) |
| | | if (index == roomTempList.Count - 1 && index > 2) |
| | | { |
| | | var btnRoomFrameLayoutEmpty = new FrameLayout |
| | | { |
| | |
| | | curRoom = room; |
| | | if (curRoom.ListSceneId.Count == 0) |
| | | { |
| | | btnFinifh.Enable = false; |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect; |
| | | btnFinish.Enable = false; |
| | | btnFinish.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect; |
| | | } |
| | | else |
| | | { |
| | | btnFinifh.Enable = true; |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | btnFinish.Enable = true; |
| | | btnFinish.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | } |
| | | if (targetListDevice.Count == 0 && targetListScene.Count == 0) |
| | | { |
| | | btnFinifh.Enable = false; |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect; |
| | | btnFinish.Enable = false; |
| | | btnFinish.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect; |
| | | } |
| | | else |
| | | { |
| | | btnFinifh.Enable = true; |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | btnFinish.Enable = true; |
| | | btnFinish.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | } |
| | | RefreshSceneList(curRoom); |
| | | |
| | |
| | | btnRoomFrameLayout.MouseUpEventHandler += eHandlerRoom; |
| | | index++; |
| | | } |
| | | BindInfo.FinishDisplay(roomTempList, btnFinifh); |
| | | BindInfo.FinishDisplay(roomTempList, btnFinish); |
| | | RefreshSceneList(curRoom); |
| | | } |
| | | |
| | |
| | | var currentSceneUIList = GetMatchSceneUIList(curRoom); |
| | | if (currentSceneUIList.Count == 0) |
| | | { |
| | | btnFinifh.Enable = false; |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect; |
| | | btnFinish.Enable = false; |
| | | btnFinish.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect; |
| | | return; |
| | | } |
| | | foreach (var scene in currentSceneUIList) |
| | |
| | | } |
| | | if (targetListDevice.Count == 0 && targetListScene.Count == 0) |
| | | { |
| | | btnFinifh.Enable = false; |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect; |
| | | btnFinish.Enable = false; |
| | | btnFinish.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect; |
| | | } |
| | | else |
| | | { |
| | | btnFinifh.Enable = true; |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | btnFinish.Enable = true; |
| | | btnFinish.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | } |
| | | }; |
| | | rowLayout.MouseUpEventHandler += hander; |
| | |
| | | } |
| | | if (targetListDevice.Count == 0 && targetListScene.Count == 0) |
| | | { |
| | | btnFinifh.Enable = false; |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect; |
| | | btnFinish.Enable = false; |
| | | btnFinish.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect; |
| | | } |
| | | else |
| | | { |
| | | btnFinifh.Enable = true; |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | btnFinish.Enable = true; |
| | | btnFinish.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | } |
| | | } |
| | | |
| | |
| | | RefreshSceneList(roomList[0]); |
| | | if (targetListDevice.Count == 0 && targetListScene.Count == 0) |
| | | { |
| | | btnFinifh.Enable = false; |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect; |
| | | btnFinish.Enable = false; |
| | | btnFinish.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMUnSelect; |
| | | } |
| | | else |
| | | { |
| | | btnFinifh.Enable = true; |
| | | btnFinifh.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | btnFinish.Enable = true; |
| | | btnFinish.BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | } |
| | | dialog.Close(); |
| | | }; |
| | |
| | | List<SceneUI> GetALlDispalyRoomSceneList() |
| | | { |
| | | currentKeyAllRoomSceneList.Clear(); |
| | | // 获取所有房间 |
| | | // 获取所有房间 |
| | | var listAllRoom = HdlRoomLogic.Current.GetAllListRooms(); |
| | | foreach (var room in listAllRoom) |
| | | { |