HDL Home App 第二版本 旧平台金堂用 正在使用
hxb
2022-08-30 25429f085093d89d543a0b90e30d0d62d1b7dac9
ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceRelayDetailCardForm.cs
@@ -109,8 +109,8 @@
        {
            //开关的背景图片
            var picSwitchBack = new FrameLayout();
            picSwitchBack.Height = Application.GetMinRealAverage(579);
            picSwitchBack.Width = Application.GetMinRealAverage(579);
            picSwitchBack.Height = this.GetPictrueRealSize(579);
            picSwitchBack.Width = this.GetPictrueRealSize(579);
            picSwitchBack.Y = Application.GetRealHeight(340);
            picSwitchBack.BackgroundImagePath = "Light/OnOff.png";
            picSwitchBack.Gravity = Gravity.CenterHorizontal;
@@ -120,8 +120,8 @@
            var btnClose = new IconViewControl(81);
            btnClose.UnSelectedImagePath = "Light/OFF.png";
            btnClose.SelectedImagePath = "Light/OFFSelected.png";
            btnClose.X = Application.GetMinRealAverage(101);
            btnClose.Y = Application.GetMinRealAverage(248);
            btnClose.X = this.GetPictrueRealSize(101);
            btnClose.Y = this.GetPictrueRealSize(248);
            picSwitchBack.AddChidren(btnClose);
            listControl.Add(btnClose);
@@ -129,7 +129,7 @@
            var btnOpen = new IconViewControl(81);
            btnOpen.UnSelectedImagePath = "Light/ON.png";
            btnOpen.SelectedImagePath = "Light/ONSelected.png";
            btnOpen.X = Application.GetMinRealAverage(397);
            btnOpen.X = this.GetPictrueRealSize(397);
            btnOpen.Y = btnClose.Y;
            picSwitchBack.AddChidren(btnOpen);
            listControl.Add(btnOpen);
@@ -215,9 +215,6 @@
        /// <param name="isOpen">打开状态</param>
        private void RefreshSwitchStatu(bool isOpen)
        {
            //状态一致(第二索引的控件如果是选择状态,则必定为开状态)
            if (listControl[1].IsSelected == isOpen) { return; }
            //变更状态
            if (this.device.DfunctionType == DeviceFunctionType.A开关)
            {
@@ -232,6 +229,8 @@
                listControl[0].IsSelected = isOpen;
                listControl[1].IsSelected = isOpen;
            }
            //设置状态文字
            this.SetStatuText(HdlDeviceOtherLogic.Current.GetDeviceStatu(this.device));
        }
        #endregion
@@ -246,19 +245,14 @@
        /// <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.RefreshSwitchStatu(((LightBase)this.device).OnOffStatus == 1);
                    //设置状态文字
                    this.SetStatuText(HdlDeviceOtherLogic.Current.GetDeviceStatu(this.device));
                });
                return true;
            }
            return false;
        }
@@ -273,32 +267,36 @@
        /// <param name="isOpen"></param>
        private void SetSwitchCommand(bool isOpen)
        {
            //如果住宅为虚拟住宅
            if (Common.Config.Instance.Home.IsVirtually == true)
            {
                ((LightBase)this.device).OnOffStatus = isOpen == true ? 1 : 0;
                //变更卡片状态
                this.RefreshSwitchStatu(((LightBase)this.device).OnOffStatus == 1);
                return;
            }
            //检测是否获取网关反馈的结果,如果网关没有回复,则会弹出消息
            this.StartCheckResponeResult(this.listControl, (result) =>
            {
                //没有接收到网关回复
                if (result == false)
                //接收到网关回复
                if (result == true)
                {
                    HdlThreadLogic.Current.RunMain(() =>
                    {
                        //设置状态文字
                        this.SetStatuText(HdlDeviceOtherLogic.Current.GetDeviceStatu(this.device));
                    {
                        //变更卡片状态
                        bool statu = ((LightBase)this.device).OnOffStatus == 1;
                        this.RefreshSwitchStatu(statu);
                    });
                }
            });
            //变更卡片状态
            this.RefreshSwitchStatu(isOpen);
            if (isOpen == true)
            {
                //打开
                this.SetStatuText(Language.StringByID(R.MyInternationalizationString.uOpen1));
                this.device.SwitchControl(1);
            }
            else
            {
                //关闭
                this.SetStatuText(Language.StringByID(R.MyInternationalizationString.Close));
                this.device.SwitchControl(0);
            }
        }