黄学彪
2020-12-17 9f326f4000847e6167d8166fa2f6a66f53cb3734
ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceCurtainDetailCardForm.cs
@@ -61,7 +61,7 @@
            this.ScrollEnabled = false;
            this.WcdType = ((Rollershade)this.device).WcdType;
            //设置状态文字
            this.SetStatuText(HdlDeviceOtherLogic.Current.GetDeviceStatu(this.device));
            this.SetStatuText(HdlDeviceCommonLogic.Current.GetMainPageDeviceStatuText(this.device));
            if (WcdType == 0)
            {
@@ -83,6 +83,22 @@
            btnOpen.Y = Application.GetRealHeight(994) - btnOpen.YOffset;
            btnOpen.ButtonClickEvent += (sender, e) =>
            {
                //如果住宅为虚拟住宅,则此功能无效
                if (Common.Config.Instance.Home.IsVirtually == true)
                {
                    ((Rollershade)device).WcdCurrentPositionLiftPercentage = 100;
                    if (this.WcdType == 0)
                    {
                        SeekBarSiphonateCurtain.Progress = 100;
                    }
                    else
                    {
                        SeekBarOpenCurtain.Progress = 100;
                    }
                    //设置状态文字
                    this.SetStatuText(HdlDeviceCommonLogic.Current.GetMainPageDeviceStatuText(this.device));
                    return;
                }
                //发送窗帘命令
                this.SetCurtainCommand(0);
            };
@@ -98,6 +114,11 @@
            btnStop.Y = btnOpen.Y;
            btnStop.ButtonClickEvent += (sender, e) =>
            {
                //如果住宅为虚拟住宅,则此功能无效
                if (Common.Config.Instance.Home.IsVirtually == true)
                {
                    return;
                }
                //发送窗帘命令
                this.SetCurtainCommand(2);
            };
@@ -111,6 +132,22 @@
            btnClose.Y = btnOpen.Y;
            btnClose.ButtonClickEvent += (sender, e) =>
            {
                //如果住宅为虚拟住宅,则此功能无效
                if (Common.Config.Instance.Home.IsVirtually == true)
                {
                    ((Rollershade)device).WcdCurrentPositionLiftPercentage = 0;
                    if (this.WcdType == 0)
                    {
                        SeekBarSiphonateCurtain.Progress = 0;
                    }
                    else
                    {
                        SeekBarOpenCurtain.Progress = 0;
                    }
                    //设置状态文字
                    this.SetStatuText(HdlDeviceCommonLogic.Current.GetMainPageDeviceStatuText(this.device));
                    return;
                }
                //发送窗帘命令
                this.SetCurtainCommand(1);
            };
@@ -143,13 +180,12 @@
            //卷帘控件
            this.SeekBarSiphonateCurtain = new CurtainRollSeekBar();
            SeekBarSiphonateCurtain.Y = Application.GetRealHeight(300);
            SeekBarSiphonateCurtain.Width = Application.GetMinRealAverage(438);
            SeekBarSiphonateCurtain.Height = Application.GetMinRealAverage(576);
            SeekBarSiphonateCurtain.Width = this.GetPictrueRealSize(438);
            SeekBarSiphonateCurtain.Height = this.GetPictrueRealSize(576);
            SeekBarSiphonateCurtain.Gravity = Gravity.CenterHorizontal;
            SeekBarSiphonateCurtain.Progress = (device as Rollershade).WcdCurrentPositionLiftPercentage;
            frameWhiteBack.AddChidren(SeekBarSiphonateCurtain);
            SeekBarSiphonateCurtain.IsProgressTextShow = false;
            SeekBarSiphonateCurtain.CurtainPaddingTop = Application.GetRealHeight(110);
            //卷帘控件里面的那个显示百分比的控件
            int progressY = SeekBarSiphonateCurtain.Y - Application.GetMinReal(204);
@@ -193,7 +229,16 @@
                //变更进度百分比的显示
                btnProgress.Y = progressY + SeekBarSiphonateCurtain.NowProgressY;
                btnProgress.Text = value + "%";
                nowProgressValue = value;
                if (Common.Config.Instance.Home.IsVirtually == false)
                {
                    nowProgressValue = value;
                }
                else
                {
                    //如果住宅为虚拟住宅,直接改缓存
                    (device as Rollershade).WcdCurrentPositionLiftPercentage = value;
                }
            };
            if (this.hadInitControl == true)
@@ -233,8 +278,8 @@
            //开合帘控件
            this.SeekBarOpenCurtain = new CurtainSeekBar();
            SeekBarOpenCurtain.Y = Application.GetRealHeight(334);
            SeekBarOpenCurtain.Width = Application.GetMinRealAverage(570);
            SeekBarOpenCurtain.Height = Application.GetMinRealAverage(513);
            SeekBarOpenCurtain.Width = this.GetPictrueRealSize(570);
            SeekBarOpenCurtain.Height = this.GetPictrueRealSize(513);
            SeekBarOpenCurtain.Gravity = Gravity.CenterHorizontal;
            SeekBarOpenCurtain.IsProgressTextShow = false;
            SeekBarOpenCurtain.Progress = (device as Rollershade).WcdCurrentPositionLiftPercentage;
@@ -280,7 +325,16 @@
            {
                btnProgress.X = progressX + SeekBarOpenCurtain.NowProgressX - Application.GetMinReal(5);
                btnProgress.Text = value + "%";
                nowProgressValue = value;
                if (Common.Config.Instance.Home.IsVirtually == false)
                {
                    nowProgressValue = value;
                }
                else
                {
                    //如果住宅为虚拟住宅,直接修改缓存
                    (device as Rollershade).WcdCurrentPositionLiftPercentage = value;
                }
            };
            //开一个线程,监视是否滑动的滑动条,每秒检测一次
@@ -311,19 +365,20 @@
        /// <param name="comand"></param>
        private void SetCurtainCommand(int comand)
        {
            //2020.07.20变更:放开限制,不再等待网关回复,也能点击按钮
            //在没有接收到反馈之前,不能再点击
            this.btnClose.CanClick = false;
            this.btnOpen.CanClick = false;
            this.btnStop.CanClick = false;
            //this.btnClose.CanClick = false;
            //this.btnOpen.CanClick = false;
            //this.btnStop.CanClick = false;
            //检测是否获取网关反馈的结果,如果网关没有回复,则会弹出消息
            this.StartCheckResponeResult(new List<ButtonBase>(), (result) =>
            {
                //时间结束,可以再次点击
                this.btnClose.CanClick = true;
                this.btnOpen.CanClick = true;
                this.btnStop.CanClick = true;
            });
            //this.StartCheckResponeResult(new List<ButtonBase>(), (result) =>
            //{
            //    //时间结束,可以再次点击
            //    this.btnClose.CanClick = true;
            //    this.btnOpen.CanClick = true;
            //    this.btnStop.CanClick = true;
            //});
            //发送命令
            ((Rollershade)device).CurtainUpDownStopControl(comand);
        }
@@ -340,16 +395,12 @@
        /// <returns></returns>
        public override bool CheckResponeResultStatu(ReceiveComandDiv comandDiv, CommonDevice report)
        {
            if (comandDiv == ReceiveComandDiv.A节点控制反馈)
            {
                return true;
            }
            else if (comandDiv == ReceiveComandDiv.A设备属性上报)
            if (comandDiv == ReceiveComandDiv.A设备属性上报)
            {
                HdlThreadLogic.Current.RunMain(() =>
                {
                    //设置状态文字
                    this.SetStatuText(HdlDeviceOtherLogic.Current.GetDeviceStatu(this.device));
                    this.SetStatuText(HdlDeviceCommonLogic.Current.GetMainPageDeviceStatuText(this.device));
                    if (this.isProgressing == false)
                    {
                        //当进度值在手动变更中时,不接收推送
@@ -363,6 +414,7 @@
                        }
                    }
                });
                return true;
            }
            return false;
        }