| | |
| | | /// </summary>
|
| | | private SeekBarControl seekBarColor = null;
|
| | | /// <summary>
|
| | | /// MaxLevel
|
| | | /// </summary>
|
| | | private const int MaxLevel = 254;
|
| | | /// <summary>
|
| | | /// 亮度进度值是否在改变中
|
| | | /// </summary>
|
| | | private bool isLightProgressing = false;
|
| | |
| | | seekBarLight.ProgressTextSize = 14;
|
| | | seekBarLight.ProgressTextColor = UserCenterColor.Current.TextGrayColor2;
|
| | | seekBarLight.Gravity = Gravity.Frame;
|
| | | seekBarLight.Progress = (int)(((ColorTemperatureLight)this.device).Level * 1.0 / MaxLevel * 100);
|
| | | seekBarLight.Progress = HdlDeviceCommonLogic.Current.CalculateLightLevelPersent(((ColorTemperatureLight)this.device).Level);
|
| | | frameWhiteBack.AddChidren(seekBarLight);
|
| | |
|
| | | //色温
|
| | |
| | | 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 (nowLightValue != oldLightValue)
|
| | | {
|
| | | oldLightValue = nowLightValue;
|
| | | ((ColorTemperatureLight)this.device).SetLevel((int)(oldLightValue * MaxLevel / 100.0));
|
| | | ((ColorTemperatureLight)this.device).SetLevel(HdlDeviceCommonLogic.Current.CalculateLightLevel(oldLightValue));
|
| | | }
|
| | | //发送色温值
|
| | | if (nowColorValue != oldColorValue)
|
| | |
| | | if (nowLightValue != oldLightValue)
|
| | | {
|
| | | //发送亮度值
|
| | | ((ColorTemperatureLight)this.device).SetLevel((int)(nowLightValue * MaxLevel / 100.0));
|
| | | ((ColorTemperatureLight)this.device).SetLevel(HdlDeviceCommonLogic.Current.CalculateLightLevel(nowLightValue));
|
| | | }
|
| | | 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.isLightProgressing == false)
|
| | | {
|
| | | //当进度值在手动变更中时,不接收推送
|
| | | seekBarLight.Progress = (int)(((ColorTemperatureLight)this.device).Level * 1.0 / MaxLevel * 100);
|
| | | int progress = HdlDeviceCommonLogic.Current.CalculateLightLevelPersent(((ColorTemperatureLight)this.device).Level);
|
| | | if (seekBarLight.Progress != progress)
|
| | | {
|
| | | seekBarLight.Progress = progress;
|
| | | }
|
| | | }
|
| | | if (this.isColorProgressing == false)
|
| | | {
|