| | |
| | | /// </summary> |
| | | void LoadSensorDiv(Function sensor,int index) |
| | | { |
| | | if (sensor.spk==SPK.SensorLight) { |
| | | //先过滤掉光照传感器 |
| | | return; |
| | | } |
| | | var levelColorList = sensorTemp.GetLevelColorList(sensor.spk); |
| | | var levelTextList = sensorTemp.GetLevelTextList(sensor.spk); |
| | | { |
| | |
| | | |
| | | btnIcon.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | if (!IsSupportClick(sensor)) |
| | | { |
| | | return; |
| | | } |
| | | #region |
| | | var esp = new EnvironmentalSensorPage(sensor); |
| | | MainPage.BasePageView.AddChidren(esp); |
| | |
| | | sensorView.AddChidren(btnInfoIcon); |
| | | btnInfoIcon.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | if (!IsSupportClick(sensor)) |
| | | { |
| | | return; |
| | | } |
| | | LoadInfo(sensor); |
| | | }; |
| | | |
| | |
| | | Width = Application.GetRealWidth(100), |
| | | Height = Application.GetRealWidth(32), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = sensorTemp.GetLevelColorList(sensor.spk)[sensorTemp.GetCurLevel(sensor) - 1], |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | TextID = levelTextList[sensorTemp.GetCurLevel(sensor) - 1], |
| | | Tag = "SensorLevel", |
| | | }; |
| | | sensorView.AddChidren(btnLevel); |
| | | |
| | | btnLevel.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | if (!IsSupportClick(sensor)) |
| | | { |
| | | return; |
| | | } |
| | | #region |
| | | var esp = new EnvironmentalSensorPage(sensor); |
| | | MainPage.BasePageView.AddChidren(esp); |
| | |
| | | sensorView.AddChidren(btnSensorValues); |
| | | btnSensorValues.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | if (!IsSupportClick(sensor)) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | #region |
| | | var esp = new EnvironmentalSensorPage(sensor); |
| | | MainPage.BasePageView.AddChidren(esp); |
| | |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | #endregion |
| | | }; |
| | | |
| | | if (!IsSupportClick(sensor)) |
| | | { |
| | | btnLevel.TextID = StringId.guangzhao; |
| | | btnLevel.TextColor = 0xFF1B2D4D; |
| | | btnSensorValues.Text = sensor.GetAttrState("illuminance"); |
| | | } |
| | | else |
| | | { |
| | | btnLevel.TextID = levelTextList[sensorTemp.GetCurLevel(sensor) - 1]; |
| | | btnLevel.TextColor = sensorTemp.GetLevelColorList(sensor.spk)[sensorTemp.GetCurLevel(sensor) - 1]; |
| | | btnSensorValues.Text = sensor.GetAttrState(FunctionAttributeKey.Value); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 是否支持事件 |
| | | /// </summary> |
| | | /// <param name="device"></param> |
| | | /// <returns></returns> |
| | | bool IsSupportClick(Function device) |
| | | { |
| | | if (device == null) |
| | | { |
| | | return false; |
| | | } |
| | | if (device.spk == SPK.SensorLight) |
| | | { |
| | | //先过滤掉光照传感器 |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | #region event |
| | | |