黄学彪
2020-12-17 9f326f4000847e6167d8166fa2f6a66f53cb3734
ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceColorTemperatureLightDetailCardForm.cs
@@ -57,7 +57,7 @@
            if (((LightBase)this.device).OnOffStatus == 1)
            {
                //亮度 XX
                this.SetStatuText(Language.StringByID(R.MyInternationalizationString.uBrightness) + "  " + HdlDeviceOtherLogic.Current.GetDeviceStatu(this.device));
                this.SetStatuText(Language.StringByID(R.MyInternationalizationString.uBrightness) + "  " + HdlDeviceCommonLogic.Current.GetMainPageDeviceStatuText(this.device));
            }
            else
            {
@@ -75,6 +75,7 @@
            waveSeekBar.MaxValue = 100;
            waveSeekBar.Progress = (int)(((ColorTemperatureLight)this.device).Level * 1.0 / MaxLevel * 100);
            waveSeekBar.CornerRadius = Application.GetRealHeight(58);
            waveSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCWaveSeekBarColor_Start, ZigbeeColor.Current.GXCWaveSeekBarColor_End);
            frameWhiteBack.AddChidren(waveSeekBar);
            //开关
@@ -97,13 +98,6 @@
            if (IsLightOpen == true)
            {
                btnSwitch.IsSelected = true;
                waveSeekBar.IsClickable = true;
                waveSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCWaveSeekBarColor_Start, ZigbeeColor.Current.GXCWaveSeekBarColor_End);
            }
            else
            {
                waveSeekBar.IsClickable = false;
                waveSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor, ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor);
            }
            //彩灯控件里面的那个显示百分比的控件
@@ -159,7 +153,7 @@
                    //如果住宅为虚拟住宅,直接改缓存
                    ((ColorTemperatureLight)this.device).Level = value * MaxLevel / 100;
                    //亮度 XX
                    this.SetStatuText(Language.StringByID(R.MyInternationalizationString.uBrightness) + "  " + HdlDeviceOtherLogic.Current.GetDeviceStatu(this.device));
                    this.SetStatuText(Language.StringByID(R.MyInternationalizationString.uBrightness) + "  " + HdlDeviceCommonLogic.Current.GetMainPageDeviceStatuText(this.device));
                }
            };
@@ -252,10 +246,18 @@
        /// <param name="isOpen"></param>
        private void SetSwitchCommand(bool isOpen)
        {
            //获取当前亮度
            int level = Convert.ToInt32(this.device.GetType().InvokeMember("Level", System.Reflection.BindingFlags.GetField, null, this.device, null));
            //如果住宅是虚拟住宅
            if (Common.Config.Instance.Home.IsVirtually == true)
            {
                ((LightBase)this.device).OnOffStatus = isOpen == true ? 1 : 0;
                if (((LightBase)this.device).OnOffStatus == 1 && level == 0)
                {
                    //如果当前是打开状态,并且亮度为0的话,则需要变成100%亮度
                    this.device.GetType().InvokeMember("Level", System.Reflection.BindingFlags.SetField, null, this.device, new object[] { 100 });
                }
                //刷新开关状态
                this.RefreshSwitchStatu(isOpen);
                return;
@@ -278,20 +280,20 @@
                        //状态取反
                        listControl[0].IsSelected = statu;
                    }
                    if (statu == true)
                    {
                        //等待结果结束后,彩灯控件可以滑动
                        waveSeekBar.IsClickable = true;
                    }
                });
            });
            //发送等待的时间内,不能滑动彩灯控件
            waveSeekBar.IsClickable = false;
            if (isOpen == true)
            {
                //打开
                this.device.SwitchControl(1);
                if (level == 0)
                {
                    //如果当前是打开状态,并且亮度为0的话,则需要变成100%亮度
                    this.device.GetType().InvokeMember("SetLevel", System.Reflection.BindingFlags.InvokeMethod, null, this.device, new object[] { 254 });
                }
                else
                {
                    this.device.SwitchControl(1);
                }
            }
            else
            {
@@ -337,39 +339,24 @@
            if (isOpen == true)
            {
                //亮度是必须要刷新的  亮度 XX
                this.SetStatuText(Language.StringByID(R.MyInternationalizationString.uBrightness) + "  " + HdlDeviceOtherLogic.Current.GetDeviceStatu(this.device));
                if (this.isProgressing == false)
                {
                    //当进度值在手动变更中时,不接收推送
                    waveSeekBar.Progress = (int)(((ColorTemperatureLight)this.device).Level * 1.0 / MaxLevel * 100);
                }
                this.SetStatuText(Language.StringByID(R.MyInternationalizationString.uBrightness) + "  " + HdlDeviceCommonLogic.Current.GetMainPageDeviceStatuText(this.device));
            }
            if (isOpen == false && this.IsLightOpen == true)
            {
                //状态不一样,才变更字样:关闭
                this.SetStatuText(Language.StringByID(R.MyInternationalizationString.Close));
            }
            if (listControl[0].IsSelected != isOpen)
            {
                //开关状态变更
                listControl[0].IsSelected = isOpen;
            }
            //状态不一样才变更
            if (this.IsLightOpen != isOpen)
            if (this.isProgressing == false)
            {
                if (isOpen == true)
                {
                    waveSeekBar.IsClickable = true;
                    waveSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCWaveSeekBarColor_Start, ZigbeeColor.Current.GXCWaveSeekBarColor_End);
                }
                else
                {
                    waveSeekBar.IsClickable = false;
                    waveSeekBar.SetProgressBarColors(ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor, ZigbeeColor.Current.GXCWaveSeekBarUnSelectedColor);
                }
                //当进度值在手动变更中时,不接收推送
                waveSeekBar.Progress = (int)(((ColorTemperatureLight)this.device).Level * 1.0 / MaxLevel * 100);
            }
            this.IsLightOpen = isOpen;
            //回复的结果说,处于打开状态才能发送
            this.canSetProgressValue = this.IsLightOpen;