From 0fa1534827bd21d763216550d11006fc1441c6cb Mon Sep 17 00:00:00 2001 From: tzy <hxb@hdlchina.com.cn> Date: 星期五, 14 五月 2021 17:08:45 +0800 Subject: [PATCH] 门锁初始上传 --- HDL_ON/UI/UI0-Stan/Controls/CompoundControls/BatteryPersentControl.cs | 52 ++++++++++++++++++++++++++++++---------------------- 1 files changed, 30 insertions(+), 22 deletions(-) diff --git a/HDL_ON/UI/UI0-Stan/Controls/CompoundControls/BatteryPersentControl.cs b/HDL_ON/UI/UI0-Stan/Controls/CompoundControls/BatteryPersentControl.cs index bf88dae..2ba65dc 100644 --- a/HDL_ON/UI/UI0-Stan/Controls/CompoundControls/BatteryPersentControl.cs +++ b/HDL_ON/UI/UI0-Stan/Controls/CompoundControls/BatteryPersentControl.cs @@ -7,7 +7,7 @@ namespace HDL_ON.Stan { /// <summary> - /// 鐢垫睜鐧惧垎姣旀帶浠� + /// 鐢垫睜鐧惧垎姣旀帶浠�(楂樹负25) /// </summary> public class BatteryPersentControl : NormalFrameLayout { @@ -21,13 +21,17 @@ /// 杩涘害鏉� /// </summary> private NormalViewControl btnProgress = null; + /// <summary> + /// 鍥炬爣鎺т欢 + /// </summary> + private IconViewControl btnIcon = null; #endregion #region 鈻� 鍒濆鍖朹____________________________ /// <summary> - /// 鐢垫睜鐧惧垎姣旀帶浠� + /// 鐢垫睜鐧惧垎姣旀帶浠�(楂樹负25) /// </summary> public BatteryPersentControl() { @@ -39,19 +43,23 @@ /// <summary> /// 鍒濆鍖栨帶浠� /// </summary> - public void InitControl() + /// <param name="showPersent">鏄惁鍦ㄥ彸杈规樉绀虹櫨鍒嗘瘮</param> + public void InitControl(bool showPersent = true) { - var btnIcon = new IconViewControl(24); - btnIcon.UnSelectedImagePath = "FunctionIcon/Electrical/WeepRobot/Battery.png"; + this.btnIcon = new IconViewControl(24); + btnIcon.UnSelectedImagePath = "Public/BatteryEnough.png"; this.AddChidren(btnIcon); //鐢垫睜鐧惧垎姣� - this.btnBatteryView = new NormalViewControl(30, 16, true); - btnBatteryView.X = btnIcon.Right + Application.GetRealWidth(4); - btnBatteryView.Y = btnIcon.Y + (btnIcon.Height - Application.GetRealHeight(16)) / 2; - btnBatteryView.TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel; - btnBatteryView.TextColor = CSS_Color.PromptingColor1; - this.AddChidren(btnBatteryView); + if (showPersent == true) + { + this.btnBatteryView = new NormalViewControl(30, 16, true); + btnBatteryView.X = btnIcon.Right + Application.GetRealWidth(4); + btnBatteryView.Y = btnIcon.Y + (btnIcon.Height - Application.GetRealHeight(16)) / 2; + btnBatteryView.TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel; + btnBatteryView.TextColor = CSS_Color.PromptingColor1; + this.AddChidren(btnBatteryView); + } //杩涘害鏉℃帶浠� this.btnProgress = new NormalViewControl(this.GetPictrueRealSize(15), this.GetPictrueRealSize(8), false); @@ -72,23 +80,23 @@ public void SetValue(decimal i_value) { int myWidth = (int)((i_value / 100) * this.GetPictrueRealSize(15)); - this.btnBatteryView.Text = i_value + "%"; + if (this.btnBatteryView != null) + { + this.btnBatteryView.Text = i_value + "%"; + } + this.btnProgress.Width = myWidth; if (i_value <= 20) { - if (this.btnProgress.BackgroundColor == CSS_Color.PromptingColor1) - { - //鍙樼孩鑹� - this.btnProgress.BackgroundColor = 0xfff62f48; - } + //鍙樼孩鑹� + this.btnProgress.BackgroundColor = 0xfff62f48; + this.btnIcon.UnSelectedImagePath = "Public/BatteryNot.png"; } else { - if (this.btnProgress.BackgroundColor == 0xfff62f48) - { - //鍙樼孩鑹� - this.btnProgress.BackgroundColor = CSS_Color.PromptingColor1; - } + //鍙樼伆鑹� + this.btnProgress.BackgroundColor = CSS_Color.PromptingColor1; + this.btnIcon.UnSelectedImagePath = "Public/BatteryEnough.png"; } } -- Gitblit v1.8.0