| | |
| | | /// </summary>
|
| | | private List<ButtonBase> listControl = new List<ButtonBase>();
|
| | | /// <summary>
|
| | | /// MaxLevel
|
| | | /// </summary>
|
| | | private const int MaxLevel = 254;
|
| | | /// <summary>
|
| | | /// 彩灯控件
|
| | | /// </summary>
|
| | | private WaveSeekBar waveSeekBar = null;
|
| | |
| | | waveSeekBar.Gravity = Gravity.CenterHorizontal;
|
| | | waveSeekBar.WavePadding = Application.GetRealWidth(8);
|
| | | waveSeekBar.MaxValue = 100;
|
| | | waveSeekBar.Progress = (int)(((ColorTemperatureLight)this.device).Level * 1.0 / MaxLevel * 100);
|
| | | waveSeekBar.Progress = HdlDeviceCommonLogic.Current.CalculateLightLevelPersent(((ColorTemperatureLight)this.device).Level);
|
| | | waveSeekBar.CornerRadius = Application.GetRealHeight(58);
|
| | | if (this.IsLightOpen == true)
|
| | | {
|
| | |
| | | else
|
| | | {
|
| | | //如果住宅为虚拟住宅,直接改缓存
|
| | | ((ColorTemperatureLight)this.device).Level = value * MaxLevel / 100;
|
| | | ((ColorTemperatureLight)this.device).Level = HdlDeviceCommonLogic.Current.CalculateLightLevel(value);
|
| | | //亮度 XX
|
| | | this.SetStatuText(Language.StringByID(R.MyInternationalizationString.uBrightness) + " " + HdlDeviceOtherLogic.Current.GetDeviceStatu(this.device));
|
| | | }
|
| | |
| | | if (nowProgressValue != oldProgressValue)
|
| | | {
|
| | | oldProgressValue = nowProgressValue;
|
| | | ((ColorTemperatureLight)this.device).SetLevel((int)(oldProgressValue * MaxLevel / 100.0));
|
| | | ((ColorTemperatureLight)this.device).SetLevel(HdlDeviceCommonLogic.Current.CalculateLightLevel(oldProgressValue));
|
| | | }
|
| | | //发送色温值
|
| | | if (nowColorValue != oldColorValue)
|
| | |
| | | if (nowProgressValue != oldProgressValue)
|
| | | {
|
| | | //发送亮度值
|
| | | ((ColorTemperatureLight)this.device).SetLevel((int)(nowProgressValue * MaxLevel / 100.0));
|
| | | ((ColorTemperatureLight)this.device).SetLevel(HdlDeviceCommonLogic.Current.CalculateLightLevel(nowProgressValue));
|
| | | }
|
| | | if (nowColorValue != oldColorValue)
|
| | | {
|
| | |
| | | if (level == 0)
|
| | | {
|
| | | //如果当前是打开状态,并且亮度为0的话,则需要变成100%亮度
|
| | | this.device.GetType().InvokeMember("SetLevel", System.Reflection.BindingFlags.InvokeMethod, null, this.device, new object[] { 254 });
|
| | | this.device.GetType().InvokeMember("SetLevel", System.Reflection.BindingFlags.InvokeMethod, null, this.device, new object[] { 255 });
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | if (this.isProgressing == false)
|
| | | {
|
| | | //当进度值在手动变更中时,不接收推送
|
| | | waveSeekBar.Progress = (int)(((ColorTemperatureLight)this.device).Level * 1.0 / MaxLevel * 100);
|
| | | int progress = HdlDeviceCommonLogic.Current.CalculateLightLevelPersent(((ColorTemperatureLight)this.device).Level);
|
| | | if (waveSeekBar.Progress != progress)
|
| | | {
|
| | | waveSeekBar.Progress = progress;
|
| | | }
|
| | | }
|
| | |
|
| | | this.IsLightOpen = isOpen;
|