wxr
2024-10-18 a40848272e33822f72a7fe0310f079717bf73f23
HDL_ON/UI/UI2/FuntionControlView/ArmSensor/SensorWaterImmersionPage.cs
@@ -47,12 +47,38 @@
            })
            { IsBackground = true }.Start();
        }
        BatteryPersentControl batteryControl;
        /// <summary>
        /// 初始化第一个索引页的内容
        /// </summary>
        private void InitFrameWhiteContent1()
        {
            //电池控件
            this.batteryControl = new BatteryPersentControl();
            //它有个最小的X轴
            batteryControl.X = Application.GetRealWidth(104) > base.btnRoomName.Right ? Application.GetRealWidth(104) : base.btnRoomName.Right + Application.GetRealWidth(4);
            if (batteryControl.Height > base.btnRoomName.Height)
            {
                //一个是25,一个是21,弄不准到底谁更高,因为计算方法不一样
                batteryControl.Y = base.btnRoomName.Y - (batteryControl.Height - base.btnRoomName.Height) / 2;
            }
            else
            {
                batteryControl.Y = base.btnRoomName.Y + (batteryControl.Height - base.btnRoomName.Height) / 2;
            }
            batteryControl.InitControl(false);
            batteryControl.SetValue(80);
            var powerLowTipAttr = device.attributes.Find((obj) => obj.key == FunctionAttributeKey.BatteryState);
            if (powerLowTipAttr != null)
            {
                if(powerLowTipAttr.state.ToLower() == "low")
                {
                    batteryControl.SetValue(20);
                }
            }
            FrameWhiteCentet1.AddChidren(batteryControl);
            btnIcon = new IconViewControl(198)
            {
                Gravity = Gravity.CenterHorizontal,
@@ -136,6 +162,19 @@
                        btnSuctionView.IsSelected = false;
                    }
                }
                var powerLowTipAttr = device.attributes.Find((obj) => obj.key == FunctionAttributeKey.BatteryState);
                if (powerLowTipAttr != null)
                {
                    if (powerLowTipAttr.state.ToLower() == "low")
                    {
                        batteryControl.SetValue(20);
                    }
                    else
                    {
                        batteryControl.SetValue(80);
                    }
                }
            });
        }