| | |
| | | /// </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 room; |
| | | #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; |
| | | var sameDevList = new List<DeviceUI> { }; |
| | | 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; |
| | | } |
| | | sameDevList.Add(device); |
| | | typeDeviceDic[info.BeloneTextId] = sameDevList; |
| | | 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) |
| | | { |
| | | typeRowLayout = new FrameLayout() |
| | | { |
| | | Width = Application.GetRealWidth(220), |
| | | }; |
| | | functionTypeScrowView.AddChidren(typeRowLayout); |
| | | |
| | | 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 (typeRowLayout.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]; |
| | |
| | | }) |
| | | { 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); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | if (room.IsLove) |
| | | { |
| | | roomBtn.IsSelected = true; |
| | | this.room = room; |
| | | curBtn = roomBtn; |
| | | |
| | | if(sceneBtn.IsSelected) |
| | |
| | | (sender as Button).IsSelected = true; |
| | | curBtn.IsSelected = false; |
| | | curBtn = sender as Button; |
| | | this.room = room; |
| | | if (sceneBtn.IsSelected) |
| | | { |
| | | RefreshScene(room); |
| | |
| | | } |
| | | }; |
| | | } |
| | | |
| | | } |
| | | |
| | | #endregion |