| | |
| | | /// </summary>
|
| | | private SeekBarControl seekBarColor = null;
|
| | | /// <summary>
|
| | | /// MaxLevel
|
| | | /// </summary>
|
| | | private const int MaxLevel = 254;
|
| | | /// <summary>
|
| | | /// 亮度进度值是否在改变中
|
| | | /// </summary>
|
| | | private bool isLightProgressing = false;
|
| | |
| | | if (((LightBase)this.device).OnOffStatus == 1)
|
| | | {
|
| | | //亮度 XX
|
| | | this.SetStatuText(Language.StringByID(R.MyInternationalizationString.uBrightness) + " " + HdlDeviceCommonLogic.Current.GetMainPageDeviceStatuText(this.device));
|
| | | this.SetStatuText(Language.StringByID(R.MyInternationalizationString.uBrightness) + " " + HdlDeviceOtherLogic.Current.GetDeviceStatu(this.device));
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | btnLightView.Y = Application.GetRealHeight(320);
|
| | | frameWhiteBack.AddChidren(btnLightView);
|
| | | //底线
|
| | | var btnLightLine = new NormalViewControl(Application.GetRealWidth(841), HdlControlResourse.BottomLineHeight, false);
|
| | | var btnLightLine = new NormalViewControl(Application.GetRealWidth(841), ControlCommonResourse.BottomLineHeight, false);
|
| | | btnLightLine.BackgroundColor = UserCenterColor.Current.ButtomLine;
|
| | | btnLightLine.X = btnLightView.X;
|
| | | btnLightLine.Y = btnLightView.Bottom + Application.GetRealHeight(37);
|
| | |
| | | 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);
|
| | |
|
| | | //色温
|
| | |
| | | btnColorView.Y = btnLightLine.Y + Application.GetRealHeight(107);
|
| | | frameWhiteBack.AddChidren(btnColorView);
|
| | | //底线
|
| | | var btnColorLine = new NormalViewControl(Application.GetRealWidth(841), HdlControlResourse.BottomLineHeight, false);
|
| | | var btnColorLine = new NormalViewControl(Application.GetRealWidth(841), ControlCommonResourse.BottomLineHeight, false);
|
| | | btnColorLine.BackgroundColor = UserCenterColor.Current.ButtomLine;
|
| | | btnColorLine.X = btnColorView.X;
|
| | | btnColorLine.Y = btnColorView.Bottom + Application.GetRealHeight(37);
|
| | |
| | | btnBuzzerView.Y = btnColorLine.Y + Application.GetRealHeight(107);
|
| | | frameWhiteBack.AddChidren(btnBuzzerView);
|
| | | //底线
|
| | | var btnBuzzerLine = new NormalViewControl(Application.GetRealWidth(841), HdlControlResourse.BottomLineHeight, false);
|
| | | var btnBuzzerLine = new NormalViewControl(Application.GetRealWidth(841), ControlCommonResourse.BottomLineHeight, false);
|
| | | btnBuzzerLine.BackgroundColor = UserCenterColor.Current.ButtomLine;
|
| | | btnBuzzerLine.X = btnBuzzerView.X;
|
| | | btnBuzzerLine.Y = btnBuzzerView.Bottom + Application.GetRealHeight(37);
|
| | |
| | | btnMiniView.Y = btnBuzzerLine.Y + Application.GetRealHeight(107);
|
| | | frameWhiteBack.AddChidren(btnMiniView);
|
| | | //底线
|
| | | var btnMiniLine = new NormalViewControl(Application.GetRealWidth(841), HdlControlResourse.BottomLineHeight, false);
|
| | | var btnMiniLine = new NormalViewControl(Application.GetRealWidth(841), ControlCommonResourse.BottomLineHeight, false);
|
| | | btnMiniLine.BackgroundColor = UserCenterColor.Current.ButtomLine;
|
| | | btnMiniLine.X = btnMiniView.X;
|
| | | btnMiniLine.Y = btnMiniView.Bottom + Application.GetRealHeight(37);
|
| | |
| | | else
|
| | | {
|
| | | //如果住宅为虚拟住宅,直接改缓存
|
| | | ((ColorTemperatureLight)this.device).Level = value * MaxLevel / 100;
|
| | | ((ColorTemperatureLight)this.device).Level = HdlDeviceCommonLogic.Current.CalculateLightLevel(value);
|
| | | //亮度 XX
|
| | | this.SetStatuText(Language.StringByID(R.MyInternationalizationString.uBrightness) + " " + HdlDeviceCommonLogic.Current.GetMainPageDeviceStatuText(this.device));
|
| | | 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
|
| | | {
|
| | |
| | | private void AddReceiveBuzzerAckEvent()
|
| | | {
|
| | | //Ack主题上报
|
| | | string mainKeys = HdlDeviceCommonLogic.Current.GetDeviceMainKeys(this.device);
|
| | | string mainKeys = LocalDevice.Current.GetDeviceMainKeys(this.device);
|
| | | HdlGatewayReceiveLogic.Current.AddAttributeEvent("DeviceBuzzerDetailCardACK", ReceiveComandDiv.A节点控制反馈, (report) =>
|
| | | {
|
| | | string mainKey2 = HdlDeviceCommonLogic.Current.GetDeviceMainKeys(report);
|
| | | string mainKey2 = LocalDevice.Current.GetDeviceMainKeys(report);
|
| | | if (mainKeys != mainKey2)
|
| | | {
|
| | | //不是同一个东西
|
| | |
| | | if (isOpen == true)
|
| | | {
|
| | | //亮度是必须要刷新的 亮度 XX
|
| | | this.SetStatuText(Language.StringByID(R.MyInternationalizationString.uBrightness) + " " + HdlDeviceCommonLogic.Current.GetMainPageDeviceStatuText(this.device));
|
| | | this.SetStatuText(Language.StringByID(R.MyInternationalizationString.uBrightness) + " " + HdlDeviceOtherLogic.Current.GetDeviceStatu(this.device));
|
| | | if (this.btnMiniSwitch.IsSelected == false)
|
| | | {
|
| | | this.btnMiniSwitch.IsSelected = true;
|
| | |
| | | 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)
|
| | | {
|