From 9a4629512ccf8359efd88671c9317c3cc7faf0c8 Mon Sep 17 00:00:00 2001
From: hxb <hxb@hdlchina.com.cn>
Date: 星期一, 29 八月 2022 16:46:40 +0800
Subject: [PATCH] Merge branch 'dev' into dev-temp
---
ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/ProgressRowBar.cs | 473 ++++++++++++++++++++++++++++++++--------------------------
1 files changed, 261 insertions(+), 212 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/ProgressRowBar.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/ProgressRowBar.cs
old mode 100755
new mode 100644
index aebe897..0bb1e06
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/ProgressRowBar.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/ProgressRowBar.cs
@@ -1,212 +1,261 @@
-锘縰sing System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace Shared.Phone.UserCenter
-{
- /// <summary>
- /// 琛屾潯绫诲瀷鐨勮繘搴︽潯鎺т欢
- /// </summary>
- public class ProgressRowBar : FrameLayout
- {
- #region 鈻� 鍙橀噺澹版槑___________________________
-
- /// <summary>
- /// 浼氱Щ鍔ㄧ殑杩涘害鏉�
- /// </summary>
- private FrameLayout btnProgressBar = null;
- /// <summary>
- /// 鏁板�肩櫨鍒嗘瘮鏂囨湰鐨勫鍣�
- /// </summary>
- private FrameLayout frameProgressBack = null;
- /// <summary>
- /// 鏄剧ず鏁板�肩櫨鍒嗘瘮鐨勬帶浠�
- /// </summary>
- private NormalViewControl btnProgressTextView = null;
- /// <summary>
- /// 绾跨▼鏄惁杩愯
- /// </summary>
- private bool isThreadAction = false;
- /// <summary>
- /// 妯″紡鍖哄垎
- /// </summary>
- private int m_ModeDiv = -1;
-
- #endregion
-
- #region 鈻� 鍒濆鍖朹____________________________
-
- /// <summary>
- /// 琛屾潯绫诲瀷鐨勮繘搴︽潯鎺т欢
- /// </summary>
- /// <param name="width">闈炵湡瀹炲��</param>
- /// <param name="height">闈炵湡瀹炲��</param>
- public ProgressRowBar(int width, int height)
- {
- this.Height = Application.GetRealHeight(height);
- this.Width = Application.GetRealWidth(width);
- this.BackgroundColor = 0xffe6e6e6;
- this.Radius = (uint)Application.GetRealHeight(height) / 2;
- }
-
- #endregion
-
- #region 鈻� 妯″紡1______________________________
-
- /// <summary>
- /// 妯″紡1 璇ユā寮忎负锛氭墜鍔ㄥ~鍐欒繘搴﹀��
- /// </summary>
- /// <param name="showText">鏄惁鍦ㄨ繘搴︽潯涓婃柟鏄剧ず鏁板�肩櫨鍒嗘瘮</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 = 0xfffb744a;
- btnProgressBar.Radius = (uint)this.Height / 2;
- this.AddChidren(btnProgressBar);
-
- if (showText == true)
- {
- //杩涘害鍊兼枃鏈�
- this.frameProgressBack = new FrameLayout();
- frameProgressBack.Width = Application.GetRealWidth(84);
- frameProgressBack.Height = Application.GetRealHeight(60);
- frameProgressBack.Y = this.Y - Application.GetRealHeight(60);
- frameProgressBack.X = this.X - Application.GetRealWidth(84) / 2;
- this.Parent.AddChidren(frameProgressBack);
-
- var btnProgressPic = new PicViewControl(84, 60);
- btnProgressPic.UnSelectedImagePath = "Item/ProgressMsg.png";
- frameProgressBack.AddChidren(btnProgressPic);
- this.btnProgressTextView = new NormalViewControl(84, 45, true);
- btnProgressTextView.TextSize = 10;
- btnProgressTextView.TextAlignment = TextAlignment.Center;
- btnProgressTextView.Text = "0%";
- frameProgressBack.AddChidren(btnProgressTextView);
- }
- }
-
- /// <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 || value > 1)
- {
- return;
- }
- HdlThreadLogic.Current.RunMain(() =>
- {
- int width = (int)(value * this.Width);
- btnProgressBar.Width = width;
- if (this.btnProgressTextView != null)
- {
- //鏂囨湰鏄剧ず
- btnProgressTextView.Text = ((int)(value * 100)) + "%";
- //鏂囨湰鏄剧ず鐨勯偅涓浘鐗囨绉诲姩
- this.frameProgressBack.X = ControlCommonResourse.XXLeft + btnProgressBar.Right - frameProgressBack.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
- }
-}
+锘縰sing System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Shared.Phone.UserCenter
+{
+ /// <summary>
+ /// 琛屾潯绫诲瀷鐨勮繘搴︽潯鎺т欢
+ /// </summary>
+ public class ProgressRowBar : FrameLayout
+ {
+ #region 鈻� 鍙橀噺澹版槑___________________________
+
+ /// <summary>
+ /// 杩涘害鏉¤兘鍚﹀線鍥炶蛋(榛樿涓嶅彲浠�)
+ /// </summary>
+ public bool ProgressBarGoback = false;
+ /// <summary>
+ /// 浼氱Щ鍔ㄧ殑杩涘害鏉�
+ /// </summary>
+ private FrameLayout btnProgressBar = null;
+ /// <summary>
+ /// 鏁板�肩櫨鍒嗘瘮鏂囨湰鐨勫鍣�
+ /// </summary>
+ private FrameLayout frameProgressBack = 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.frameProgressBack != null)
+ {
+ this.frameProgressBack.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 = 0xffe6e6e6;
+ 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 = 0xfffb744a;
+ btnProgressBar.Radius = (uint)this.Height / 2;
+ this.AddChidren(btnProgressBar);
+
+ if (showText == true)
+ {
+ //杩涘害鍊兼枃鏈�
+ this.frameProgressBack = new FrameLayout();
+ frameProgressBack.Width = Application.GetRealWidth(120);
+ frameProgressBack.Height = Application.GetRealHeight(60);
+ frameProgressBack.Y = this.Y - Application.GetRealHeight(60);
+ frameProgressBack.X = this.X - Application.GetRealWidth(84) / 2;
+ this.Parent.AddChidren(frameProgressBack);
+
+ var btnProgressPic = new PicViewControl(84, 60);
+ btnProgressPic.UnSelectedImagePath = "Item/ProgressMsg.png";
+ btnProgressPic.Gravity = Gravity.CenterHorizontal;
+ frameProgressBack.AddChidren(btnProgressPic);
+ this.btnProgressTextView = new NormalViewControl(120, 45, true);
+ btnProgressTextView.TextSize = 10;
+ btnProgressTextView.TextAlignment = TextAlignment.Center;
+ btnProgressTextView.Text = "0%";
+ btnProgressTextView.Gravity = Gravity.CenterHorizontal;
+ frameProgressBack.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.frameProgressBack.X = this.X + btnProgressBar.Right - frameProgressBack.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