HDL Home App 第二版本 旧平台金堂用 正在使用
黄学彪
2020-07-24 0087dd7734e71dfcfd1bb54db394ad7855021ffd
ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceMiniLightDetailCardForm.cs
@@ -132,6 +132,7 @@
            seekBarColor.SeekBarPadding = Application.GetRealWidth(60);
            seekBarColor.IsProgressTextShow = true;
            seekBarColor.ProgressBarColor = UserCenterColor.Current.Transparent;
            seekBarColor.ProgressBarUnEnableColor = UserCenterColor.Current.Transparent;
            seekBarColor.SeekBarBackgroundColor = UserCenterColor.Current.Transparent;
            seekBarColor.ProgressTextSize = 14;
            seekBarColor.ProgressTextColor = UserCenterColor.Current.TextGrayColor2;
@@ -161,6 +162,7 @@
            this.btnBuzzerSwitch = new IconBigViewControl(81, 81);
            btnBuzzerSwitch.UnSelectedImagePath = "Item/Switch.png";
            btnBuzzerSwitch.SelectedImagePath = "Item/SwitchSelected.png";
            btnBuzzerSwitch.IsSelected = ((ColorTemperatureLight)this.device).IsBuzzerRing;
            frameWhiteBack.AddChidren(btnBuzzerSwitch);
            btnBuzzerSwitch.InitControl();
            btnBuzzerSwitch.UseClickStatu = false;
@@ -200,6 +202,12 @@
            };
            btnMiniSwitch.IsSelected = ((LightBase)this.device).OnOffStatus == 1;
            this.canSetProgressValue = btnMiniSwitch.IsSelected;
            if (btnMiniSwitch.IsSelected == false)
            {
                //在没有打开夜灯开关之前,不允许滑动
                seekBarLight.Enable = false;
                seekBarColor.Enable = false;
            }
            //亮度开始滑动的事件
            seekBarLight.OnStartTrackingTouchEvent += (sender, e) =>
@@ -347,7 +355,13 @@
                         {
                             //当是打开状态时,网关说它会默认把亮度变成100%
                             //以防万一,这里再次读取一下
                             ((ColorTemperatureLight)device).ReadLevel();
                             HdlThreadLogic.Current.RunThread(() =>
                             {
                                 ((ColorTemperatureLight)device).ReadLevel();
                                 System.Threading.Thread.Sleep(300);
                                 ((ColorTemperatureLight)device).ReadColorTemperature();
                             });
                         }
                     }
                 });
@@ -379,25 +393,19 @@
            //如果住宅是虚拟住宅
            if (Common.Config.Instance.Home.IsVirtually == true)
            {
                //((LightBase)this.device).OnOffStatus = isOpen == true ? 1 : 0;
                ////刷新开关状态
                //this.RefreshSwitchStatu(isOpen);
                ((ColorTemperatureLight)this.device).IsBuzzerRing = isOpen;
                //刷新开关状态
                this.RefreshSwitchStatu(isOpen);
                return;
            }
            //检测是否获取网关反馈的结果,如果网关没有回复,则会弹出消息
            this.StartCheckResponeResult(new List<ButtonBase> { this.btnBuzzerSwitch.btnIcon }, (result) =>
            this.btnBuzzerSwitch.CanClick = false;
            this.StartCheckResponeResult(new List<ButtonBase>(), (result) =>
            {
                HdlThreadLogic.Current.RunMain(() =>
                {
                    //接收到网关回复
                    if (result == true)
                    {
                        this.btnBuzzerSwitch.IsSelected = isOpen;
                        //bool statu = ((LightBase)this.device).OnOffStatus == 1;
                        ////刷新开关状态
                        //this.RefreshSwitchStatu(statu);
                    }
                    this.btnBuzzerSwitch.CanClick = true;
                });
            });
            //发送命令
@@ -463,11 +471,13 @@
        /// <param name="isOpen">打开状态</param>
        private void RefreshSwitchStatu(bool isOpen)
        {
            if (this.isColorProgressing == true)
            //刷新蜂鸣器开关状态
            bool isBuzzerRing = ((ColorTemperatureLight)this.device).IsBuzzerRing;
            if (this.btnBuzzerSwitch.IsSelected != isBuzzerRing)
            {
                //如果是色温滑动的话,不需要刷新界面
                return;
                this.btnBuzzerSwitch.IsSelected = isBuzzerRing;
            }
            if (isOpen == true)
            {
                //亮度是必须要刷新的  亮度 XX
@@ -482,13 +492,25 @@
                    //当进度值在手动变更中时,不接收推送
                    seekBarColor.Progress = (int)(((ColorTemperatureLight)this.device).ColorTemperature / 100);
                }
                this.btnMiniSwitch.IsSelected = true;
                if (this.btnMiniSwitch.IsSelected == false)
                {
                    this.btnMiniSwitch.IsSelected = true;
                }
                //滑动条可以滑动
                seekBarLight.Enable = true;
                seekBarColor.Enable = true;
            }
            else
            {
                //变更字样:关闭
                this.SetStatuText(Language.StringByID(R.MyInternationalizationString.Close));
                this.btnMiniSwitch.IsSelected = false;
                if (this.btnMiniSwitch.IsSelected == true)
                {
                    this.btnMiniSwitch.IsSelected = false;
                }
                //滑动条不可以滑动
                seekBarLight.Enable = false;
                seekBarColor.Enable = false;
            }
            //回复的结果说,处于打开状态才能发送