| | |
| | | /// <summary> |
| | | /// 功能类型按钮 |
| | | /// </summary> |
| | | private FunctionButton functionTypeIMG; |
| | | //private FunctionButton functionTypeIMG; |
| | | /// <summary> |
| | | /// 功能类型 |
| | | /// </summary> |
| | |
| | | /// <summary> |
| | | /// 设备类型RowLayout |
| | | /// </summary> |
| | | private FrameLayout typeRowLayout; |
| | | //private FrameLayout typeRowLayout; |
| | | /// <summary> |
| | | /// 楼层 |
| | | /// </summary> |
| | |
| | | /// </summary> |
| | | private Button selectFloorBtn; |
| | | |
| | | /// <summary> |
| | | /// 相同类型的设备列表 |
| | | /// </summary> |
| | | private Dictionary<int, List<DeviceUI>> typeDeviceDic; |
| | | /// <summary> |
| | | /// 设备类型的图id |
| | | /// </summary> |
| | | private Dictionary<int, DeviceConcreteType> typeIdDic; |
| | | /// <summary> |
| | | /// dList |
| | | /// </summary> |
| | | private List<DeviceUI> devList; |
| | | /// <summary> |
| | | /// sceneList |
| | | /// </summary> |
| | | private List<SceneUI> sceneList; |
| | | /// <summary> |
| | | /// 当前选中房间 |
| | | /// </summary> |
| | | private Common.Room curRoom; |
| | | #endregion |
| | | |
| | | #region ◆ 接口____________________________ |
| | |
| | | /// <param name="selectedBtn">选中那个界面 0--功能 1--场景 2--自动化 </param> |
| | | public void Show(int selectedBtn = 1) |
| | | { |
| | | InitData(); |
| | | |
| | | RemoveAll(); |
| | | |
| | | #region topview |
| | |
| | | midFL.AddChidren(functionSceneAutoBG); |
| | | |
| | | //场景 |
| | | sceneBtn = new ButtonLineForm(CommonFormResouce.X_Left, 34, 150, 68); |
| | | sceneBtn = new ButtonLineForm(CommonFormResouce.X_Left, 34); |
| | | functionSceneAutoBG.AddChidren(sceneBtn); |
| | | sceneBtn.Init(); |
| | | sceneBtn.SetTitle(R.MyInternationalizationString.Scence); |
| | | //功能 |
| | | functionBtn = new ButtonLineForm(CommonFormResouce.X_Left + 150 + 20, 34, 150, 68); |
| | | functionBtn = new ButtonLineForm(CommonFormResouce.X_Left + 150 + 20, 34); |
| | | functionSceneAutoBG.AddChidren(functionBtn); |
| | | functionBtn.Init(); |
| | | functionBtn.SetTitle(R.MyInternationalizationString.Function); |
| | | functionBtn.X = sceneBtn.Right; |
| | | //自动化 |
| | | automationBtn = new ButtonLineForm(CommonFormResouce.X_Left + 150 * 2 + 20+50, 34, 150, 68); |
| | | automationBtn = new ButtonLineForm(CommonFormResouce.X_Left + 150 * 2 + 20+50, 34); |
| | | automationBtn.Init(); |
| | | automationBtn.SetTitle(R.MyInternationalizationString.Automation); |
| | | automationBtn.X = functionBtn.Right; |
| | | //隐藏自动化 |
| | | if (UserCenter.UserCenterResourse.UserInfo.AuthorityNo != 3) |
| | | { |
| | |
| | | Gravity = Gravity.CenterVertical, |
| | | TextAlignment = TextAlignment.CenterRight, |
| | | TextColor = ZigbeeColor.Current.GXCTextBlackColor, |
| | | TextSize=14, |
| | | IsBold=true |
| | | }; |
| | | |
| | | selectFloorBtn = new Button() |
| | |
| | | #endregion |
| | | //绑定按钮事件 |
| | | BindEvent(); |
| | | |
| | | } |
| | | #endregion |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// InitData |
| | | /// </summary> |
| | | private void InitData() |
| | | { |
| | | typeDeviceDic = new Dictionary<int, List<DeviceUI>> { }; |
| | | typeIdDic = new Dictionary<int, DeviceConcreteType> { }; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// RefreshData |
| | | /// </summary> |
| | | private void RefreshData(Common.Room room) |
| | | { |
| | | devList = room.DeviceUIList; |
| | | sceneList = room.SceneUIList; |
| | | typeDeviceDic.Clear(); |
| | | typeIdDic.Clear(); |
| | | foreach (var device in devList) |
| | | { |
| | | var info = Common.LocalDevice.Current.GetNotHdlMyDeviceEnumInfo(new List<CommonDevice> { device.CommonDevice }); |
| | | if (info.BeloneType == DeviceBeloneType.A干接点 || info.BeloneType == DeviceBeloneType.A中继器) |
| | | { |
| | | continue; |
| | | } |
| | | if (typeDeviceDic.ContainsKey(info.BeloneTextId) == false) |
| | | { |
| | | var sameDevList = new List<DeviceUI> { }; |
| | | sameDevList.Add(device); |
| | | typeDeviceDic[info.BeloneTextId] = sameDevList; |
| | | } |
| | | else |
| | | { |
| | | typeDeviceDic[info.BeloneTextId].Add(device); |
| | | } |
| | | typeIdDic[info.BeloneTextId] = info.ConcreteType; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ◆ 功能____________________________ |
| | |
| | | /// <param name="room"></param> |
| | | private void RefreshFunction(Common.Room room) |
| | | { |
| | | RefreshData(room); |
| | | //移除监听 |
| | | RemoveAllUpdateControlDeviceStatuAction(); |
| | | functionSceneBodyView.RemoveAll(); |
| | | |
| | | if (room.DeviceUIList.Count == 0) |
| | | if (typeDeviceDic.Count == 0) |
| | | { |
| | | ShowNoFunctionTip(); |
| | | } |
| | | else |
| | | { |
| | | var functionTypeView1 = new FrameLayout |
| | | { |
| | | X = Application.GetRealWidth(CommonFormResouce.X_Left), |
| | | Height = Application.GetRealHeight(160), |
| | | Width = Application.GetRealWidth(1028), |
| | | BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor |
| | | }; |
| | | functionSceneBodyView.AddChidren(functionTypeView1); |
| | | functionTypeView1.SetCornerWithSameRadius(Application.GetRealHeight(17), HDLUtils.RectCornerTopLeft); |
| | | |
| | | var functionTypeView2 = new FrameLayout |
| | | { |
| | | X = Application.GetRealWidth(CommonFormResouce.X_Left), |
| | | Y = Application.GetRealHeight(150), |
| | | Height = Application.GetRealHeight(279 - 150), |
| | | Width = Application.GetRealWidth(1028), |
| | | BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor |
| | | }; |
| | | functionSceneBodyView.AddChidren(functionTypeView2); |
| | | functionTypeView2.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerBottomLeft); |
| | | |
| | | functionTypeScrowView = new HorizontalScrolViewLayout |
| | | { |
| | | X = Application.GetRealWidth(CommonFormResouce.X_Left), |
| | | Height = Application.GetRealHeight(279), |
| | | Width = Application.GetRealWidth(1028), |
| | | BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor |
| | | }; |
| | | functionSceneBodyView.AddChidren(functionTypeScrowView); |
| | | //functionSceneBodyView.SetCornerWithSameRadius(Application.GetRealHeight(50), HDLUtils.RectCornerBottomLeft); |
| | | |
| | | deviceListScrolView = new VerticalScrolViewLayout |
| | | { |
| | | X = Application.GetRealWidth(CommonFormResouce.X_Left), |
| | | Y = Application.GetRealHeight(35+275), |
| | | Width = Application.GetRealWidth(1028), |
| | | Height = Application.GetRealHeight(938) - 1, |
| | | Height = Application.GetRealHeight(939), |
| | | BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor |
| | | }; |
| | | functionSceneBodyView.AddChidren(deviceListScrolView); |
| | | //deviceListScrolView.SetCornerWithSameRadius(Application.GetRealHeight(50), HDLUtils.RectCornerTopLeft); |
| | | deviceListScrolView.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft); |
| | | |
| | | tempFunctionTypeBtn = new FunctionButton(); |
| | | tempFunctionTypeBtn.Init("",""); |
| | | |
| | | EventHandler<MouseEventArgs> ShowSameTypeFunction = (object typeSender, MouseEventArgs mouseEventArgs) => |
| | | foreach (var deviceType in typeIdDic) |
| | | { |
| | | var typeRowLayout = new FrameLayout() |
| | | { |
| | | Width = Application.GetRealWidth(220), |
| | | }; |
| | | functionTypeScrowView.AddChidren(typeRowLayout); |
| | | |
| | | var functionTypeIMG = new FunctionButton() |
| | | { |
| | | Tag = deviceType.Key |
| | | }; |
| | | string imgPath = string.Empty; |
| | | string imgSeletedPath = string.Empty; |
| | | Common.LocalDevice.Current.GetDeviceBeloneIcon(deviceType.Value, ref imgPath, ref imgSeletedPath); |
| | | functionTypeIMG.Init(imgPath, imgSeletedPath); |
| | | functionTypeIMG.SetTitle(deviceType.Key); |
| | | typeRowLayout.AddChidren(functionTypeIMG); |
| | | |
| | | functionTypeIMG.ClickBtn.MouseUpEventHandler += ShowSameTypeFunction; |
| | | |
| | | if (functionTypeScrowView.ChildrenCount == 1) |
| | | { |
| | | ShowSameTypeFunction(functionTypeIMG.ImageBtn, null); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 显示相同类型的功能 |
| | | /// </summary> |
| | | /// <param name="typeSender">typeSender.</param> |
| | | /// <param name="mouseEventArgs">The ${ParameterType} instance containing the event data.</param> |
| | | private void ShowSameTypeFunction(object typeSender, MouseEventArgs mouseEventArgs) |
| | | { |
| | | tempFunctionTypeBtn.IsSelected = false; |
| | | tempFunctionTypeBtn = (typeSender as Button).Parent as FunctionButton; |
| | |
| | | deviceListScrolView.RemoveAll(); |
| | | |
| | | var sameTypeList = new List<DeviceUI> { }; |
| | | foreach (var devieceUI in room.DeviceUIList) |
| | | { |
| | | if (devieceUI == null || devieceUI.CommonDevice == null) |
| | | { |
| | | continue; |
| | | } |
| | | if (devieceUI.CommonDevice.Type.ToString() == (typeSender as Button).Tag.ToString()) |
| | | { |
| | | if (!sameTypeList.Contains(devieceUI)) |
| | | { |
| | | sameTypeList.Add(devieceUI); |
| | | } |
| | | } |
| | | } |
| | | sameTypeList = typeDeviceDic[int.Parse((typeSender as Button).Tag.ToString())]; |
| | | |
| | | for (int i=0;i<sameTypeList.Count;i++) |
| | | { |
| | | var deviceUI = sameTypeList[i]; |
| | |
| | | UserView.HomePage.Instance.AddChidren(lightControl); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | //lightControl.action = RefreshBodyView; |
| | | lightControl.Show(deviceUI, room); |
| | | lightControl.Show(deviceUI, curRoom); |
| | | } |
| | | else if (deviceUI.CommonDevice.DfunctionType == DeviceFunctionType.A插座) |
| | | { |
| | |
| | | UserView.HomePage.Instance.AddChidren(lightControl); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | //lightControl.action = RefreshBodyView; |
| | | lightControl.Show(deviceUI, room); |
| | | lightControl.Show(deviceUI, curRoom); |
| | | } |
| | | else |
| | | { |
| | |
| | | UserView.HomePage.Instance.AddChidren(lightControl); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | //lightControl.action = RefreshBodyView; |
| | | lightControl.Show(deviceUI, room); |
| | | lightControl.Show(deviceUI, curRoom); |
| | | } |
| | | }; |
| | | |
| | |
| | | Tag = deviceUI, |
| | | Radius = 0 |
| | | }; |
| | | if (room.IsSharedRoom == false) |
| | | if (curRoom.IsSharedRoom == false) |
| | | { |
| | | deviceTypeRowLayout.AddRightView(editBtn); |
| | | editBtn.MouseUpEventHandler += deviceDetailHandler; |
| | |
| | | UserView.HomePage.Instance.AddChidren(lightControl); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | //lightControl.action = RefreshBodyView; |
| | | lightControl.Show(deviceUI, room); |
| | | lightControl.Show(deviceUI, curRoom); |
| | | }; |
| | | |
| | | var editBtn = new CommonForm.RowLayoutEditButton() |
| | |
| | | Tag = deviceUI, |
| | | Radius = 0 |
| | | }; |
| | | if (room.IsSharedRoom == false) |
| | | if (curRoom.IsSharedRoom == false) |
| | | { |
| | | deviceTypeRowLayout.AddRightView(editBtn); |
| | | editBtn.MouseUpEventHandler += deviceDetailHandler; |
| | |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | UserView.HomePage.Instance.ScrollEnabled = false; |
| | | //dimmableLightControl.action = RefreshBodyView; |
| | | dimmableLightControl.Show(deviceUI, room); |
| | | dimmableLightControl.Show(deviceUI, curRoom); |
| | | }; |
| | | |
| | | var editBtn = new CommonForm.RowLayoutEditButton() |
| | |
| | | Tag = deviceUI, |
| | | Radius = 0 |
| | | }; |
| | | if (room.IsSharedRoom == false) |
| | | if (curRoom.IsSharedRoom == false) |
| | | { |
| | | deviceTypeRowLayout.AddRightView(editBtn); |
| | | editBtn.MouseUpEventHandler += deviceDetailHandler; |
| | |
| | | Tag = deviceUI, |
| | | Radius = 0 |
| | | }; |
| | | if (room.IsSharedRoom == false) |
| | | if (curRoom.IsSharedRoom == false) |
| | | { |
| | | deviceTypeRowLayout.AddRightView(editBtn); |
| | | editBtn.MouseUpEventHandler += deviceDetailHandler; |
| | |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | UserView.HomePage.Instance.ScrollEnabled = false; |
| | | //rollerShadeControl.action = RefreshBodyView; |
| | | acControl.Show(deviceUI, room); |
| | | acControl.Show(deviceUI, curRoom); |
| | | }; |
| | | } |
| | | } |
| | |
| | | Tag = deviceUI, |
| | | Radius = 0 |
| | | }; |
| | | if (room.IsSharedRoom == false) |
| | | if (curRoom.IsSharedRoom == false) |
| | | { |
| | | deviceTypeRowLayout.AddRightView(editBtn); |
| | | editBtn.MouseUpEventHandler += deviceDetailHandler; |
| | |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | UserView.HomePage.Instance.ScrollEnabled = false; |
| | | //rollerShadeControl.action = RefreshBodyView; |
| | | rollerShadeControl.Show(deviceUI, room); |
| | | rollerShadeControl.Show(deviceUI, curRoom); |
| | | }; |
| | | } |
| | | } |
| | |
| | | |
| | | deviceRow.ClickBtn.MouseUpEventHandler += (send2, e2) => |
| | | { |
| | | var userDoorLockPage = new UserDoorLockPage(room, deviceUI); |
| | | var userDoorLockPage = new UserDoorLockPage(curRoom, deviceUI); |
| | | HomePage.Instance.AddChidren(userDoorLockPage); |
| | | HomePage.Instance.PageIndex += 1; |
| | | userDoorLockPage.Show(); |
| | |
| | | { |
| | | Tag = deviceUI |
| | | }; |
| | | if (room.IsSharedRoom == false) |
| | | if (curRoom.IsSharedRoom == false) |
| | | { |
| | | deviceTypeRowLayout.AddRightView(editBtn); |
| | | editBtn.MouseUpEventHandler += deviceDetailHandler; |
| | |
| | | { |
| | | Tag = deviceUI |
| | | }; |
| | | if (room.IsSharedRoom == false) |
| | | if (curRoom.IsSharedRoom == false) |
| | | { |
| | | deviceTypeRowLayout.AddRightView(editBtn); |
| | | editBtn.MouseUpEventHandler += deviceDetailHandler; |
| | |
| | | }); |
| | | }) |
| | | { IsBackground=true}.Start(); |
| | | } |
| | | }; |
| | | |
| | | foreach (var deviceType in Common.Room.GetdeviceTypes(room)) |
| | | { |
| | | typeRowLayout = new FrameLayout() |
| | | { |
| | | Width = Application.GetRealWidth(CommonPage.AppRealWidth / 5), |
| | | Tag = deviceType |
| | | }; |
| | | functionTypeScrowView.AddChidren(typeRowLayout); |
| | | |
| | | functionTypeIMG = new FunctionButton() |
| | | { |
| | | Tag = deviceType |
| | | }; |
| | | functionTypeIMG.Init(DeviceUI.GetDeviceTypeUnSelectedImagePath(deviceType), DeviceUI.GetDeviceTypeUnSelectedImagePath(deviceType)); |
| | | functionTypeIMG.SetTitle(DeviceUI.GetDeviceTypeName(deviceType)); |
| | | typeRowLayout.AddChidren(functionTypeIMG); |
| | | |
| | | functionTypeIMG.ClickBtn.MouseUpEventHandler += ShowSameTypeFunction; |
| | | |
| | | if (deviceType == room.DeviceUIList[0].CommonDevice.Type) |
| | | { |
| | | ShowSameTypeFunction(functionTypeIMG.ImageBtn, null); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | if (room.IsLove) |
| | | { |
| | | roomBtn.IsSelected = true; |
| | | this.curRoom = room; |
| | | curBtn = roomBtn; |
| | | |
| | | if(sceneBtn.IsSelected) |
| | |
| | | (sender as Button).IsSelected = true; |
| | | curBtn.IsSelected = false; |
| | | curBtn = sender as Button; |
| | | this.curRoom = room; |
| | | if (sceneBtn.IsSelected) |
| | | { |
| | | RefreshScene(room); |
| | |
| | | } |
| | | }; |
| | | } |
| | | |
| | | } |
| | | |
| | | #endregion |
| | |
| | | {
|
| | |
|
| | | functionSceneAutoBodyView.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor;
|
| | | |
| | | var bjFrameLayout = new FrameLayout |
| | | { |
| | | Width = Application.GetRealWidth(1080 - 58), |
| | |
| | | var logicScrolView = new VerticalRefreshLayout//VerticalScrolViewLayout |
| | | { |
| | | Height = functionSceneAutoBodyView.Height - bjFrameLayout.Height - bjFrameLayout.Y - scenehorizontalScrol.Height - Application.GetRealHeight(30), |
| | | BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, |
| | | BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor, |
| | | X = Application.GetRealWidth(58), |
| | | //Radius = (uint)Application.GetRealHeight(50), |
| | | Y = scenehorizontalScrol.Bottom, |