| | |
| | | |
| | | foreach (var item in DB_ResidenceData.residenceData.functionTypeList) |
| | | { |
| | | |
| | | int functionCount = 0; |
| | | int functionOnCount = 0; |
| | | switch (item) |
| | | { |
| | | case ShowFunction.Light: |
| | | #region Light |
| | | functionCount = DB_ResidenceData.functionList.lights.Count; |
| | | functionOnCount = DB_ResidenceData.functionList.lights.FindAll((obj) => obj.trait_on_off.value.ToString() == "on").Count; |
| | | #endregion |
| | | break; |
| | | case ShowFunction.AC: |
| | | #region AC |
| | | functionCount = DB_ResidenceData.functionList.aCs.Count; |
| | | functionOnCount = DB_ResidenceData.functionList.aCs.FindAll((obj) => obj.trait_on_off.value.ToString() == "on").Count; |
| | | #endregion |
| | | break; |
| | | case ShowFunction.Curtain: |
| | | #region Curtain |
| | | functionCount = DB_ResidenceData.functionList.curtains.Count; |
| | | functionOnCount = DB_ResidenceData.functionList.curtains.FindAll((obj) => obj.trait_on_off.value.ToString() == "on").Count; |
| | | #endregion |
| | | break; |
| | | case ShowFunction.FloorHeating: |
| | | #region 地热 |
| | | functionCount = DB_ResidenceData.functionList.floorHeatings.Count; |
| | | functionOnCount = DB_ResidenceData.functionList.floorHeatings.FindAll((obj) => obj.trait_on_off.value.ToString() == "on").Count; |
| | | #endregion |
| | | break; |
| | | case ShowFunction.DoorLock: |
| | | break; |
| | | case ShowFunction.Electric: |
| | | #region 电器 |
| | | functionCount = DB_ResidenceData.functionList.electricals.Count; |
| | | functionOnCount = DB_ResidenceData.functionList.electricals.FindAll((obj) => obj.trait_on_off.value.ToString() == "on").Count; |
| | | #endregion |
| | | break; |
| | | case ShowFunction.EnergyMonitoring: |
| | | break; |
| | | case ShowFunction.Environmental: |
| | | #region 环境数据 |
| | | functionCount = DB_ResidenceData.functionList.sensorsEnvironmentalScience.Count; |
| | | #endregion |
| | | break; |
| | | case ShowFunction.FreshAir: |
| | | break; |
| | | case ShowFunction.Music: |
| | | functionCount = Music.A31MusicModel.A31MusicModelList.Count; |
| | | functionOnCount = Music.A31MusicModel.A31MusicModelList.FindAll((obj) => obj.trait_on_off.value.ToString() == "on").Count; |
| | | break; |
| | | case ShowFunction.Panel: |
| | | break; |
| | | case ShowFunction.SecurityMonitoring: |
| | | break; |
| | | case ShowFunction.Sensor: |
| | | break; |
| | | case ShowFunction.VideoIntercom: |
| | | break; |
| | | |
| | | } |
| | | |
| | | if (functionCount == 0 && item != ShowFunction.Music) |
| | | { |
| | | continue; |
| | | } |
| | | |
| | | FrameLayout functionView = new FrameLayout() |
| | | { |
| | | Height = Application.GetRealWidth(161), |
| | |
| | | functionView.AddChidren(btnName); |
| | | |
| | | |
| | | int functionCount = 0; |
| | | int functionOnCount = 0; |
| | | switch (item) |
| | | { |
| | | case ShowFunction.Light: |
| | |
| | | Height = Application.GetRealWidth(32), |
| | | SelectedImagePath = "Public/PowerOpen.png", |
| | | UnSelectedImagePath = "Public/PowerClose.png", |
| | | IsSelected = functionCount == functionOnCount |
| | | IsSelected = functionOnCount > 0, |
| | | Tag = item + "_AllControl", |
| | | }; |
| | | functionView.AddChidren(btnLightPower); |
| | | |
| | | btnLightPower.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | LoadEvent_SwitchFunction(btnLightPower, item); |
| | |
| | | Height = Application.GetRealWidth(32), |
| | | SelectedImagePath = "Public/PowerOpen.png", |
| | | UnSelectedImagePath = "Public/PowerClose.png", |
| | | IsSelected = functionCount == functionOnCount |
| | | Tag = item + "_AllControl", |
| | | IsSelected = functionOnCount > 0, |
| | | }; |
| | | functionView.AddChidren(btnAcPower); |
| | | btnAcPower.MouseUpEventHandler = (sender, e) => |
| | |
| | | Height = Application.GetRealWidth(32), |
| | | UnSelectedImagePath = "FunctionIcon/Curtain/CurtainCloseIcon.png", |
| | | SelectedImagePath = "FunctionIcon/Curtain/CurtainCloseOnIcon.png", |
| | | IsSelected = functionCount == functionOnCount |
| | | Tag = item + "_AllControl", |
| | | IsSelected = functionOnCount > 0 |
| | | }; |
| | | functionView.AddChidren(btnClose); |
| | | |
| | |
| | | Height = Application.GetRealWidth(32), |
| | | SelectedImagePath = "Public/PowerOpen.png", |
| | | UnSelectedImagePath = "Public/PowerClose.png", |
| | | IsSelected = functionCount == functionOnCount |
| | | Tag = item + "_AllControl", |
| | | IsSelected = functionOnCount > 0 |
| | | }; |
| | | functionView.AddChidren(btnFhPower); |
| | | btnFhPower.MouseUpEventHandler = (sender, e) => |
| | |
| | | Height = Application.GetRealWidth(32), |
| | | SelectedImagePath = "Public/PowerOpen.png", |
| | | UnSelectedImagePath = "Public/PowerClose.png", |
| | | IsSelected = functionCount == functionOnCount |
| | | Tag = item + "_AllControl", |
| | | IsSelected = functionOnCount > 0, |
| | | }; |
| | | functionView.AddChidren(btnElectricPower); |
| | | btnElectricPower.MouseUpEventHandler = (sender, e) => |
| | |
| | | break; |
| | | |
| | | } |
| | | if (item != ShowFunction.Environmental) |
| | | if (item != ShowFunction.Environmental && functionCount != 0) |
| | | { |
| | | Button btnFunctionCount = new Button() |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | X = Application.GetRealWidth(16)+ Application.GetRealWidth(7 * functionCount.ToString().Length), |
| | | Y = btnName.Bottom, |
| | | Width = Application.GetRealWidth(120), |
| | | Height = Application.GetRealHeight(24), |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | Text = functionOnCount + "/" + functionCount, |
| | | Tag = item + "_onCount" |
| | | Text = "/" + functionCount, |
| | | }; |
| | | functionView.AddChidren(btnFunctionCount); |
| | | |
| | | Button btnOpenCount = new Button() |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | Y = btnName.Bottom, |
| | | Width = Application.GetRealWidth(12 * functionCount.ToString().Length), |
| | | Height = Application.GetRealHeight(24), |
| | | TextColor = CSS_Color.MainColor, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | Text = functionOnCount.ToString(), |
| | | Tag = item + "_onCount", |
| | | BorderWidth = 0, |
| | | }; |
| | | functionView.AddChidren(btnOpenCount); |
| | | } |
| | | index++; |
| | | } |