xm
2020-12-14 d6fb0646531172f23648441c224cdcccd721b894
ZigbeeApp/Shared/Phone/Category/Controls/DeviceRow/Base/DeviceRowCommon.cs
old mode 100755 new mode 100644
@@ -46,6 +46,10 @@
        /// </summary>
        private MostRightIconControl btnSwitch = null;
        /// <summary>
        /// 电池控件
        /// </summary>
        private IconViewControl btnBattery = null;
        /// <summary>
        /// 是否获取网关反馈的结果  0:没有获取得到  1:已经获取得到
        /// </summary>
        private int ResponeResult = 0;
@@ -111,11 +115,20 @@
            }
            btnDeviceName.X = Application.GetRealWidth(181);
            //当指定实际坐标时,这里需要的偏移量为2倍
            btnDeviceName.Y = Application.GetRealHeight(16) + this.chidrenYaxis * 2;
            btnDeviceName.Text = Common.LocalDevice.Current.GetDeviceEpointName(i_device);
            btnDeviceName.Y = Application.GetRealHeight(16) + this.chidrenYaxis * 2;
            //晾衣架显示模块名字(Mac名字)
            if (this.device.Type == DeviceType.Airer)
            {
                btnDeviceName.Text = Common.LocalDevice.Current.GetDeviceMacName(i_device);
            }
            else
            {
                btnDeviceName.Text = Common.LocalDevice.Current.GetDeviceEpointName(i_device);
            }
            btnDeviceName.SelectedTextColor = Common.ZigbeeColor.Current.GXCTextSelectedColor;
            this.frameTable.AddChidren(btnDeviceName, ChidrenBindMode.BindEvent);
            this.frameTable.AddChidren(btnDeviceName, ChidrenBindMode.BindEvent);
            if (this.hadStatuFunction == false)
            {
                //没有状态功能,则把设备名字控件中
@@ -146,6 +159,24 @@
            this.btnSwitch = new MostRightIconControl(69, 69);
            btnSwitch.UnSelectedImagePath = "Item/Switch.png";
            btnSwitch.SelectedImagePath = "Item/SwitchSelected.png";
            //电池控件
            if (this.device.Type == DeviceType.IASZone)
            {
                this.btnBattery = new IconViewControl(69);
                btnBattery.X = this.Width - Application.GetRealWidth(69 + 29);
                btnBattery.UnSelectedImagePath = "Item/Battery.png";
                btnBattery.Gravity = Gravity.CenterVertical;
                this.frameTable.AddChidren(btnBattery, ChidrenBindMode.BindEvent);
                if (chidrenYaxis != 0)
                {
                    btnBattery.Y += chidrenYaxis;
                }
                if (this.device.IsBatteryDown == false)
                {
                    btnBattery.Visible = false;
                }
            }
            //分享的房间,则不能编辑和删除
            if (this.nowSelectRoom.IsSharedRoom == false)
@@ -202,6 +233,8 @@
                        //回调控件被移除的事件
                        this.RowNeedRemoveEvent?.Invoke();
                        this.RemoveFromParent();
                        //上传空间区域信息
                        HdlRoomLogic.Current.SetRoomInfoToGateway();
                    };
                };
            }
@@ -240,7 +273,15 @@
            //设备图标也刷新
            Common.LocalDevice.Current.SetDeviceIconToControl(btnDeviceIcon, i_device);
            //设备名字
            this.btnDeviceName.Text = Common.LocalDevice.Current.GetDeviceEpointName(i_device);
            //晾衣架显示模块名字(Mac名字)
            if (this.device.Type == DeviceType.Airer)
            {
                this.btnDeviceName.Text = Common.LocalDevice.Current.GetDeviceMacName(i_device);
            }
            else
            {
                this.btnDeviceName.Text = Common.LocalDevice.Current.GetDeviceEpointName(i_device);
            }
            //检测设备是否是打开状态
            bool isOpen = this.CheckIsOpenStatu(i_device);
            if (this.isHadOpenSwitch == true && i_device.HadReadDeviceStatu == false)
@@ -249,6 +290,13 @@
                //等待网关回复后会重新刷新,不然一直是关闭状态
                isOpen = false;
            }
            //如果是传感器类,则默认是关的效果
            if (this.device.Type == DeviceType.PMSensor || this.device.Type == DeviceType.IASZone
                || this.device.Type == DeviceType.TemperatureSensor)
            {
                isOpen = false;
            }
            this.SetRowOpenStatu(isOpen);
        }
@@ -351,8 +399,8 @@
                }
            }
            else
            {
                //如果这个设备改变了房间的话,回调卡片被删除的函数
            {
                //如果这个设备改变了房间的话,回调卡片被删除的函数
                var nowRoom = HdlRoomLogic.Current.GetRoomByDevice(device);
                if (nowRoom == null || nowRoom.Id != this.nowSelectRoom.Id)
                {
@@ -419,6 +467,43 @@
        public void SetHadGetResponeResultStatu()
        {
            this.ResponeResult = 1;
        }
        /// <summary>
        /// 接收网关回复的状态(true:已经接收到网关的回复 false:还没有接收到网关回复)
        /// </summary>
        /// <returns></returns>
        public bool ReceiveResponeResultStatu()
        {
            return this.ResponeResult == 1;
        }
        #endregion
        #region ■ 显示低电量_________________________
        /// <summary>
        /// 刷新电池电量状态
        /// </summary>
        public void RefreshBatteryStatu()
        {
            if (this.btnBattery == null) { return; }
            if (this.device.IsBatteryDown == true)
            {
                //电量低,显示图标
                if (this.btnBattery.Visible == false)
                {
                    this.btnBattery.Visible = true;
                }
            }
            else
            {
                //电量足够,隐藏图标
                if (this.btnBattery.Visible == true)
                {
                    this.btnBattery.Visible = false;
                }
            }
        }
        #endregion
@@ -495,7 +580,7 @@
        /// <summary>
        /// 切换卡片状态特效
        /// </summary>
        private void SwitchRowStatuAppeal(bool isOpen)
        public void SwitchRowStatuAppeal(bool isOpen)
        {
            if (this.btnDeviceName.IsSelected == isOpen)
            {