| | |
| | | /// </summary>
|
| | | private List<ButtonBase> listControl = new List<ButtonBase>();
|
| | | /// <summary>
|
| | | /// MaxLevel
|
| | | /// </summary>
|
| | | private const int MaxLevel = 254;
|
| | | /// <summary>
|
| | | /// 彩灯控件
|
| | | /// </summary>
|
| | | private WaveSeekBar waveSeekBar = null;
|
| | |
| | | this.ScrollEnabled = false;
|
| | | //先清空
|
| | | this.listControl = new List<ButtonBase>();
|
| | | //设置初始状态
|
| | | this.IsLightOpen = ((LightBase)this.device).OnOffStatus == 1;
|
| | | //设置状态文字
|
| | | if (((LightBase)this.device).OnOffStatus == 1)
|
| | | if (this.IsLightOpen == true)
|
| | | {
|
| | | //亮度 XX
|
| | | this.SetStatuText(Language.StringByID(R.MyInternationalizationString.uBrightness) + " " + HdlDeviceOtherLogic.Current.GetDeviceStatu(this.device));
|
| | |
| | | waveSeekBar.Gravity = Gravity.CenterHorizontal;
|
| | | waveSeekBar.WavePadding = Application.GetRealWidth(8);
|
| | | waveSeekBar.MaxValue = 100;
|
| | | waveSeekBar.Progress = (int)(((DimmableLight)this.device).Level * 1.0 / MaxLevel * 100);
|
| | | waveSeekBar.Progress = HdlDeviceCommonLogic.Current.CalculateLightLevelPersent(((DimmableLight)this.device).Level);
|
| | | waveSeekBar.CornerRadius = Application.GetRealHeight(58);
|
| | | waveSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCWaveSeekBarColor_Start, ZigbeeColor.Current.GXCWaveSeekBarColor_End);
|
| | | if (this.IsLightOpen == true)
|
| | | {
|
| | | waveSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCWaveSeekBarColor_Start, ZigbeeColor.Current.GXCWaveSeekBarColor_End);
|
| | | }
|
| | | else
|
| | | {
|
| | | waveSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor, ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor);
|
| | | }
|
| | | frameWhiteBack.AddChidren(waveSeekBar);
|
| | |
|
| | | //开关
|
| | |
| | | btnSwitch.SelectedImagePath = "Item/SwitchSelected.png";
|
| | | btnSwitch.Y = waveSeekBar.Bottom + Application.GetRealHeight(84);
|
| | | btnSwitch.Gravity = Gravity.CenterHorizontal;
|
| | | btnSwitch.IsSelected = this.IsLightOpen;
|
| | | frameWhiteBack.AddChidren(btnSwitch);
|
| | | listControl.Add(btnSwitch);
|
| | | btnSwitch.ButtonClickEvent += (sender, e) =>
|
| | |
| | | //发送开关命令
|
| | | this.SetSwitchCommand(!btnSwitch.IsSelected);
|
| | | };
|
| | |
|
| | | //设置初始状态
|
| | | this.IsLightOpen = ((LightBase)this.device).OnOffStatus == 1;
|
| | | if (IsLightOpen == true)
|
| | | {
|
| | | btnSwitch.IsSelected = true;
|
| | | }
|
| | |
|
| | | //彩灯控件里面的那个显示百分比的控件
|
| | | int progressY = waveSeekBar.Y - Application.GetMinReal(154);
|
| | |
| | | else
|
| | | {
|
| | | //如果住宅为虚拟住宅,直接改缓存
|
| | | ((DimmableLight)this.device).Level = value * MaxLevel / 100;
|
| | | ((DimmableLight)this.device).Level = HdlDeviceCommonLogic.Current.CalculateLightLevel(value);
|
| | | //亮度 XX
|
| | | this.SetStatuText(Language.StringByID(R.MyInternationalizationString.uBrightness) + " " + HdlDeviceOtherLogic.Current.GetDeviceStatu(this.device));
|
| | | }
|
| | |
| | | }
|
| | | oldProgressValue = nowProgressValue;
|
| | | //发送进度值
|
| | | ((DimmableLight)this.device).SetLevel((int)(oldProgressValue * MaxLevel / 100.0));
|
| | | ((DimmableLight)this.device).SetLevel(HdlDeviceCommonLogic.Current.CalculateLightLevel(oldProgressValue));
|
| | | }
|
| | | });
|
| | | }
|
| | |
| | | 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)(((DimmableLight)this.device).Level * 1.0 / MaxLevel * 100);
|
| | | int progress = HdlDeviceCommonLogic.Current.CalculateLightLevelPersent(((DimmableLight)this.device).Level);
|
| | | if (waveSeekBar.Progress != progress)
|
| | | {
|
| | | waveSeekBar.Progress = progress;
|
| | | }
|
| | | }
|
| | |
|
| | | if (listControl[0].IsSelected != isOpen)
|
| | | {
|
| | | //开关状态变更
|
| | | listControl[0].IsSelected = isOpen;
|
| | | if (isOpen == true)
|
| | | {
|
| | | waveSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCWaveSeekBarColor_Start, ZigbeeColor.Current.GXCWaveSeekBarColor_End);
|
| | | }
|
| | | else
|
| | | {
|
| | | waveSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor, ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor);
|
| | | }
|
| | | }
|
| | |
|
| | | this.IsLightOpen = isOpen;
|