gxc
2020-01-02 00ab3ddb140ba8bb88b5cf572b004a85e1da85e9
ZigbeeApp/Shared/Phone/UserCenter/Device/AirConditioner/IndoorUnitListForm.cs
@@ -20,6 +20,10 @@
        /// 控件信息
        /// </summary>
        private Dictionary<string, RowControlInfo> dicControl = new Dictionary<string, RowControlInfo>();
        /// <summary>
        /// 激活的设备地址
        /// </summary>
        private string actionDeviceKeys = null;
        #endregion
@@ -114,6 +118,7 @@
            btnDeviceName.X = Application.GetRealWidth(193);
            btnDeviceName.Y = Application.GetRealHeight(45);
            frameTable.AddChidren(btnDeviceName, ChidrenBindMode.BindEventOnly);
            rowInfo.btnDeviceName = btnDeviceName;
            //房间
            var btnRoom = new NormalViewControl(400, 50, true);
            btnRoom.X = btnDeviceName.X;
@@ -122,6 +127,7 @@
            btnRoom.TextColor = UserCenterColor.Current.TextGrayColor1;
            btnRoom.Text = Common.Room.CurrentRoom.GetRoomNameByDevice(device);
            frameTable.AddChidren(btnRoom, ChidrenBindMode.BindEventOnly);
            rowInfo.btnRoom = btnRoom;
            //摄氏度
            var btnValue = new NormalViewControl(300, 60, true);
            btnValue.Y = Application.GetRealHeight(58);
@@ -183,6 +189,8 @@
            frameTable.ButtonClickEvent += (sender, e) =>
            {
                this.actionDeviceKeys = Common.LocalDevice.Current.GetDeviceMainKeys(device);
                var form = new IndoorUnitSettionForm();
                form.AddForm(device);
            };
@@ -245,27 +253,30 @@
                    var data = device.DeviceStatusReport.AttriBute[i];
                    if (data.AttributeId == 0)
                    {
                        //室内温度
                        if (data.AttriButeData == 0)
                        HdlThreadLogic.Current.RunMain(() =>
                        {
                            //0℃
                            rowInfo.btnValue.Text = "0.0℃";
                        }
                        else if (data.AttriButeData > 32767)
                        {
                            //负数(特殊处理)
                            string strValue = (data.AttriButeData - 65536).ToString();
                            //小数点需要一位
                            strValue = strValue.Substring(0, strValue.Length - 1);
                            rowInfo.btnValue.Text = strValue.Insert(strValue.Length - 1, ".") + "℃";
                        }
                        else
                        {
                            //小数点需要一位
                            string strValue = data.AttriButeData.ToString();
                            strValue = strValue.Substring(0, strValue.Length - 1);
                            rowInfo.btnValue.Text = strValue.Insert(strValue.Length - 1, ".") + "℃";
                        }
                            //室内温度
                            if (data.AttriButeData == 0)
                            {
                                //0℃
                                rowInfo.btnValue.Text = "0.0℃";
                            }
                            else if (data.AttriButeData > 32767)
                            {
                                //负数(特殊处理)
                                string strValue = (data.AttriButeData - 65536).ToString();
                                //小数点需要一位
                                strValue = strValue.Substring(0, strValue.Length - 1);
                                rowInfo.btnValue.Text = strValue.Insert(strValue.Length - 1, ".") + "℃";
                            }
                            else
                            {
                                //小数点需要一位
                                string strValue = data.AttriButeData.ToString();
                                strValue = strValue.Substring(0, strValue.Length - 1);
                                rowInfo.btnValue.Text = strValue.Insert(strValue.Length - 1, ".") + "℃";
                            }
                        });
                    }
                    else if (data.AttributeId == 28)
                    {
@@ -273,9 +284,12 @@
                        //Off = 0  Auto = 1 Cool = 3 Heat = 4 FanOnly = 7  Dry = 8
                        if (data.AttriButeData != 0)
                        {
                            rowInfo.btnSwitch.IsSelected = true;
                            rowInfo.btnIcon.IsSelected = true;
                            rowInfo.btnIconBack.BackgroundColor = 0xfffef1ed;
                            HdlThreadLogic.Current.RunMain(() =>
                            {
                                rowInfo.btnSwitch.IsSelected = true;
                                rowInfo.btnIcon.IsSelected = true;
                                rowInfo.btnIconBack.BackgroundColor = 0xfffef1ed;
                            });
                        }
                    }
                    else if (data.AttributeId == 4097)
@@ -283,9 +297,12 @@
                        //42:需要清洗滤网
                        if (data.AttriButeData == 42)
                        {
                            rowInfo.btnWarningIcon.Visible = true;
                            //请注意清洗滤网哦
                            rowInfo.btnWarningMsg.TextID = R.MyInternationalizationString.uPleaseClreanACfilter;
                            HdlThreadLogic.Current.RunMain(() =>
                            {
                                rowInfo.btnWarningIcon.Visible = true;
                                //请注意清洗滤网哦
                                rowInfo.btnWarningMsg.TextID = R.MyInternationalizationString.uPleaseClreanACfilter;
                            });
                        }
                    }
                }
@@ -308,6 +325,31 @@
        #endregion
        #region ■ 界面重新激活事件___________________
        /// <summary>
        /// 自身的上层界面关闭后,它自身处于最上层时,触发的事件
        /// </summary>
        public override int FormActionAgainEvent()
        {
            if (this.actionDeviceKeys != null && dicControl.ContainsKey(this.actionDeviceKeys) == true)
            {
                //刷新设备信息
                var device = Common.LocalDevice.Current.GetDevice(this.actionDeviceKeys);
                if (device != null)
                {
                    var contr = dicControl[this.actionDeviceKeys];
                    contr.btnDeviceName.Text = Common.LocalDevice.Current.GetDeviceEpointName(device);
                    contr.btnRoom.Text = Common.Room.CurrentRoom.GetRoomNameByDevice(device);
                }
            }
            this.actionDeviceKeys = null;
            return 1;
        }
        #endregion
        #region ■ 结构体_____________________________
        /// <summary>
@@ -316,6 +358,14 @@
        private class RowControlInfo
        {
            /// <summary>
            /// 设备名字
            /// </summary>
            public NormalViewControl btnDeviceName = null;
            /// <summary>
            /// 设备房间
            /// </summary>
            public NormalViewControl btnRoom = null;
            /// <summary>
            /// 设备图标背景
            /// </summary>
            public FrameLayout btnIconBack = null;