From a1b0ab7044100daaa7e0f1da2d2ca45e38098963 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期一, 29 三月 2021 09:13:25 +0800
Subject: [PATCH] 2021-3-29-2
---
HDL_ON/UI/UI0-Stan/Controls/CompoundControls/ProgressRowBar.cs | 251 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 251 insertions(+), 0 deletions(-)
diff --git a/HDL_ON/UI/UI0-Stan/Controls/CompoundControls/ProgressRowBar.cs b/HDL_ON/UI/UI0-Stan/Controls/CompoundControls/ProgressRowBar.cs
new file mode 100644
index 0000000..f110e78
--- /dev/null
+++ b/HDL_ON/UI/UI0-Stan/Controls/CompoundControls/ProgressRowBar.cs
@@ -0,0 +1,251 @@
+锘縰sing HDL_ON.Stan;
+using Shared;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace HDL_ON.UI
+{
+ /// <summary>
+ /// 琛屾潯绫诲瀷鐨勮繘搴︽潯鎺т欢
+ /// </summary>
+ public class ProgressRowBar : FrameLayout
+ {
+ #region 鈻� 鍙橀噺澹版槑___________________________
+
+ /// <summary>
+ /// 杩涘害鏉¤兘鍚﹀線鍥炶蛋(榛樿涓嶅彲浠�)
+ /// </summary>
+ public bool ProgressBarGoback = false;
+ /// <summary>
+ /// 浼氱Щ鍔ㄧ殑杩涘害鏉�
+ /// </summary>
+ private FrameLayout btnProgressBar = null;
+ /// <summary>
+ /// 鏄剧ず鏁板�肩櫨鍒嗘瘮鐨勬帶浠�
+ /// </summary>
+ private NormalViewControl btnProgressTextView = null;
+ /// <summary>
+ /// 绾跨▼鏄惁杩愯
+ /// </summary>
+ private bool isThreadAction = false;
+ /// <summary>
+ /// 妯″紡鍖哄垎
+ /// </summary>
+ private int m_ModeDiv = -1;
+
+ /// <summary>
+ /// 杩涘害鏉℃槸鍚﹀彲瑙�
+ /// </summary>
+ public new bool Visible
+ {
+ get { return base.Visible; }
+ set
+ {
+ if (this.btnProgressTextView != null)
+ {
+ this.btnProgressTextView.Visible = value;
+ }
+ base.Visible = value;
+ }
+ }
+
+ #endregion
+
+ #region 鈻� 鍒濆鍖朹____________________________
+
+ /// <summary>
+ /// 琛屾潯绫诲瀷鐨勮繘搴︽潯鎺т欢
+ /// </summary>
+ /// <param name="width">
+ /// <para>妯″紡1:浼氬姩鐨勯偅涓繘搴︽潯鐨勫搴�(闈炵湡瀹炲��)</para>
+ /// <para>妯″紡2:杩涘害鏉″湪鎸佺画鏃犻檺鐨勬潵鍥炵Щ鍔ㄧ殑鍖哄煙瀹藉害(闈炵湡瀹炲��)</para>
+ /// </param>
+ /// <param name="height">
+ /// <para>妯″紡1:浼氬姩鐨勯偅涓繘搴︽潯鐨勯珮搴�(闈炵湡瀹炲��)</para>
+ /// <para>妯″紡2:杩涘害鏉″湪鎸佺画鏃犻檺鐨勬潵鍥炵Щ鍔ㄧ殑楂樺害(闈炵湡瀹炲��)</para>
+ /// </param>
+ public ProgressRowBar(int width, int height)
+ {
+ this.Height = Application.GetRealHeight(height);
+ this.Width = Application.GetRealWidth(width);
+ this.BackgroundColor = UI.CSS.CSS_Color.BackgroundColor;
+ this.Radius = (uint)Application.GetRealHeight(height) / 2;
+ }
+
+ #endregion
+
+ #region 鈻� 妯″紡1______________________________
+
+ /// <summary>
+ /// 妯″紡1 璇ユā寮忎负锛氭墜鍔ㄥ~鍐欒繘搴﹀��
+ /// </summary>
+ /// <param name="showText">
+ /// <para>鏄惁鍦ㄨ繘搴︽潯涓婃柟鏄剧ず鏁板�肩櫨鍒嗘瘮</para>
+ /// <para>璇风‘淇濇帶浠剁殑涓婃柟鏈夎冻澶熺殑鍖哄煙(娉�:璇蜂笉瑕佹墿澶ф鎺т欢鐨勯珮搴�)</para>
+ /// </param>
+ public void StartMode1(bool showText = false)
+ {
+ if (m_ModeDiv != -1) { return; }
+ this.m_ModeDiv = 1;
+
+ //浼氱Щ鍔ㄧ殑杩涘害鏉�
+ this.btnProgressBar = new FrameLayout();
+ btnProgressBar.Width = 0;
+ btnProgressBar.Height = this.Height;
+ btnProgressBar.BackgroundColor = UI.CSS.CSS_Color.MainColor;
+ btnProgressBar.Radius = (uint)this.Height / 2;
+ this.AddChidren(btnProgressBar);
+
+ if (showText == true)
+ {
+ //杩涘害鍊兼枃鏈�
+ this.btnProgressTextView = new NormalViewControl(32, 22, true);
+ btnProgressTextView.Y = this.Y - Application.GetRealHeight(22 + 10);//10:瀹冧笌杩涘害鏉$殑闂磋窛
+ btnProgressTextView.X = this.X - Application.GetRealWidth(32) / 2;
+ btnProgressTextView.UnSelectedImagePath = "Public/ProgressMsg.png";
+ btnProgressTextView.TextSize = CSS.CSS_FontSize.PromptFontSize_SecondaryLevel;
+ btnProgressTextView.TextColor= CSS.CSS_Color.FirstLevelTitleColor;
+ btnProgressTextView.TextAlignment = TextAlignment.Center;
+ btnProgressTextView.Text = "0%";
+ this.Parent.AddChidren(btnProgressTextView);
+ }
+ }
+
+ /// <summary>
+ /// 閲嶇疆杩涘害鏉�(鍙妯″紡1鏈夋晥)
+ /// </summary>
+ public void ResetProgressBar()
+ {
+ if (this.m_ModeDiv == 1 && this.btnProgressBar != null)
+ {
+ this.btnProgressBar.Width = 0;
+ }
+ }
+
+ /// <summary>
+ /// 璁剧疆杩涘害鍊�
+ /// </summary>
+ /// <param name="value">姝ゅ�间负鐧惧垎姣斿��(涔熷氨鏄皬浜庢垨鑰呯瓑浜�1鐨�)</param>
+ public void SetValue(decimal value)
+ {
+ this.SetValueEx(value);
+ }
+
+ /// <summary>
+ /// 璁剧疆杩涘害鍊�
+ /// </summary>
+ /// <param name="value">杩涘害鍊�,鍐呴儴浼氶櫎浠axValue</param>
+ /// <param name="maxValue">鏈�澶у��</param>
+ public void SetValue(decimal value, decimal maxValue)
+ {
+ decimal result = value / maxValue;
+ this.SetValueEx(result);
+ }
+
+ /// <summary>
+ /// 璁剧疆杩涘害鍊�
+ /// </summary>
+ /// <param name="value"></param>
+ private void SetValueEx(decimal value)
+ {
+ if (btnProgressBar == null || this.m_ModeDiv != 1)
+ {
+ return;
+ }
+ if (value > 1) { value = 1; }
+
+ HdlThreadLogic.Current.RunMain(() =>
+ {
+ int width = (int)(value * this.Width);
+ if (this.ProgressBarGoback == false && btnProgressBar.Width >= width)
+ {
+ //涓嶈兘璁╄繘搴︽潯寰�鍥炶蛋
+ return;
+ }
+ btnProgressBar.Width = width;
+ if (this.btnProgressTextView != null)
+ {
+ //鏂囨湰鏄剧ず
+ btnProgressTextView.Text = ((int)(value * 100)) + "%";
+ //鏂囨湰鏄剧ず鐨勯偅涓浘鐗囨绉诲姩
+ this.btnProgressTextView.X = this.X + btnProgressBar.Right - btnProgressTextView.Width / 2;
+ }
+ });
+ }
+
+ #endregion
+
+ #region 鈻� 妯″紡2______________________________
+
+ /// <summary>
+ /// 妯″紡2 璇ユā寮忎负锛氫笉鑳芥墜鍔ㄦ寚瀹氳繘搴﹀��,鐢卞唴閮ㄧ嚎绋嬪鐞�,杩涘害鏉″湪鎸佺画鏃犻檺鐨勬潵鍥炵Щ鍔�
+ /// </summary>
+ /// <param name="proWidth">鎸佺画鏃犻檺鐨勬潵鍥炵Щ鍔ㄧ殑杩涘害鏉$殑瀹藉害(闈炵湡瀹炲��)</param>
+ public void StartMode2(int proWidth = 100)
+ {
+ if (m_ModeDiv != -1) { return; }
+ this.m_ModeDiv = 2;
+
+ //浼氱Щ鍔ㄧ殑杩涘害鏉�
+ this.btnProgressBar = new FrameLayout();
+ btnProgressBar.Width = Application.GetRealWidth(proWidth);
+ btnProgressBar.Height = this.Height;
+ btnProgressBar.BackgroundColor = 0xfffb744a;
+ btnProgressBar.Radius = (uint)this.Height / 2;
+ this.AddChidren(btnProgressBar);
+
+ //寮�鍚ā寮�2鐨勭嚎绋�
+ this.StartMode2Thread();
+ }
+
+ /// <summary>
+ /// 閲嶆柊寮�鍚ā寮�2
+ /// </summary>
+ public void ReStartMode2()
+ {
+ //寮�鍚ā寮�2鐨勭嚎绋�
+ this.StartMode2Thread();
+ }
+
+ /// <summary>
+ /// 鏆傚仠妯″紡2
+ /// </summary>
+ public void StopMode2()
+ {
+ this.isThreadAction = false;
+ }
+
+ /// <summary>
+ /// 寮�鍚ā寮�2鐨勭嚎绋�
+ /// </summary>
+ private void StartMode2Thread()
+ {
+ if (this.isThreadAction == true)
+ {
+ return;
+ }
+ this.isThreadAction = true;
+ int moveLength = Application.GetRealWidth(30);
+ HdlThreadLogic.Current.RunThread(() =>
+ {
+ while (this.Parent != null && isThreadAction == true)
+ {
+ HdlThreadLogic.Current.RunMain(() =>
+ {
+ if (this.btnProgressBar.X >= this.Width)
+ {
+ //瓒呭嚭鍙宠竟涔嬪悗,鍐嶆浠庡乏杈瑰惊鐜�
+ this.btnProgressBar.X = -this.btnProgressBar.Width;
+ return;
+ }
+ this.btnProgressBar.X += moveLength;
+ }, ShowErrorMode.NO);
+ System.Threading.Thread.Sleep(150);
+ }
+ });
+ }
+
+ #endregion
+ }
+}
--
Gitblit v1.8.0