From 6fa9d69da922c8049f5acfcbb9ce9fd26811024c Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期四, 16 四月 2020 17:10:57 +0800
Subject: [PATCH] 请合并代码

---
 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/ProgressFormBar.cs |  276 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 276 insertions(+), 0 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/ProgressFormBar.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/ProgressFormBar.cs
new file mode 100755
index 0000000..539ff34
--- /dev/null
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/ProgressFormBar.cs
@@ -0,0 +1,276 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Shared.Phone.UserCenter
+{
+    /// <summary>
+    /// 鐣岄潰绫诲瀷鐨勮繘搴︽潯鎺т欢
+    /// </summary>
+    public class ProgressFormBar
+    {
+        #region 鈻� 鍙橀噺澹版槑___________________________
+
+        /// <summary>
+        /// 鐣岄潰绫诲瀷鐨勮繘搴︽潯鎺т欢
+        /// </summary>
+        private static ProgressFormBar m_Current = null;
+        /// <summary>
+        /// 鐣岄潰绫诲瀷鐨勮繘搴︽潯鎺т欢
+        /// </summary>
+        public static ProgressFormBar Current
+        {
+            get
+            {
+                if (m_Current == null)
+                {
+                    m_Current = new ProgressFormBar();
+                }
+                return m_Current;
+            }
+        }
+        /// <summary>
+        /// 娑堟伅鎺т欢鍗曞嚮鐨勪簨浠�
+        /// </summary>
+        public Action MsgClickEvent = null;
+        /// <summary>
+        /// 鐣岄潰鍏抽棴鐨勪簨浠�
+        /// </summary>
+        public Action CloseEvent = null;
+        /// <summary>
+        /// 瀹瑰櫒鎺т欢
+        /// </summary>
+        private FrameLayout bodyFrameLayout = null;
+        /// <summary>
+        /// 淇℃伅鎺т欢
+        /// </summary>
+        private NormalViewControl btnText = null;
+        /// <summary>
+        /// 杩涘害鍊兼枃鏈殑鏄剧ず鎺т欢
+        /// </summary>
+        private NormalViewControl btnProgressView = null;
+        /// <summary>
+        /// 杩涘害鍊艰兘澶熺Щ鍔ㄧ殑閭d釜妗嗘帶浠�
+        /// </summary>
+        private FrameLayout frameProgress = null;
+        /// <summary>
+        /// 杩涘害鏉�
+        /// </summary>
+        private FrameLayout btnProgressBar = null;
+        /// <summary>
+        /// 杩涘害鏉″鍣ㄧ殑鏈�澶у搴�
+        /// </summary>
+        private int ProRowWidth = 0;
+        /// <summary>
+        /// 鍘熸潵鐨勬粦鍔ㄦ爣璇�
+        /// </summary>
+        private bool oldScrollEnabled = false;
+        /// <summary>
+        /// 鍘熸潵鐨勯偅涓渾褰㈣繘搴︽潯鏄惁鍙
+        /// </summary>
+        private bool oldPrigressVisible = false;
+
+        #endregion
+
+        #region 鈻� 鍒濆鍖朹____________________________
+
+        /// <summary>
+        /// 鍒濆鍖栬繘搴︽潯
+        /// </summary>
+        private void InitProgressFormBar()
+        {
+            //瀹夊崜鍙互鐐瑰嚮绯荤粺鐨勮繑鍥為敭
+            this.oldScrollEnabled = UserView.HomePage.Instance.ScrollEnabled;
+            UserView.HomePage.Instance.ScrollEnabled = false;
+            Shared.Common.CommonPage.BackKeyCanClick = false;
+
+            this.oldPrigressVisible = Common.CommonPage.Loading.Visible;
+            if (oldPrigressVisible == true)
+            {
+                //鍦嗗舰杩涘害鏉′复鏃跺叧闂�
+                Common.CommonPage.Loading.Hide();
+            }
+            //瀹瑰櫒
+            bodyFrameLayout = new FrameLayout();
+            bodyFrameLayout.BackgroundColor = UserCenterColor.Current.DialogBackColor;
+            Common.CommonPage.Instance.AddChidren(bodyFrameLayout);
+            //var nowForm = UserView.HomePage.Instance.GetChildren(UserView.HomePage.Instance.ChildrenCount - 1);
+            //if (nowForm != null && (nowForm is ViewGroup) == true)
+            //{
+            //    ((ViewGroup)nowForm).AddChidren(bodyFrameLayout);
+            //}
+
+            var frameBack = new FrameLayout();
+            frameBack.Width = Application.GetRealWidth(674);
+            frameBack.Height = Application.GetRealHeight(386);
+            frameBack.BackgroundColor = UserCenterColor.Current.White;
+            frameBack.Gravity = Gravity.CenterHorizontal;
+            frameBack.Y = Application.GetRealHeight(683);
+            frameBack.Radius = (uint)Application.GetRealHeight(17);
+            bodyFrameLayout.AddChidren(frameBack);
+
+            //杩涘害鏄剧ず鏂囨湰
+            this.btnText = new NormalViewControl(frameBack.Width, Application.GetRealHeight(58), false);
+            btnText.Y = Application.GetRealHeight(248);
+            btnText.TextColor = UserCenterColor.Current.TextGrayColor1;
+            btnText.TextAlignment = TextAlignment.Center;
+            frameBack.AddChidren(btnText);
+            btnText.ButtonClickEvent += (sender, e) =>
+            {
+                this.MsgClickEvent?.Invoke();
+            };
+
+            //杩涘害鏉�
+            var btnProRow = new FrameLayout();
+            btnProRow.Gravity = Gravity.CenterHorizontal;
+            btnProRow.Y = Application.GetRealHeight(161);
+            btnProRow.Width = Application.GetRealWidth(559);
+            btnProRow.Height = Application.GetRealHeight(29);
+            btnProRow.BackgroundColor = 0xfff5f5f5;
+            btnProRow.Radius = (uint)Application.GetRealHeight(29) / 2;
+            frameBack.AddChidren(btnProRow);
+            this.btnProgressBar = new FrameLayout();
+            btnProgressBar.Width = 0;
+            btnProgressBar.Height = btnProRow.Height;
+            btnProgressBar.BackgroundColor = 0xfffb744a;
+            btnProgressBar.Radius = (uint)Application.GetRealHeight(29) / 2;
+            btnProRow.AddChidren(btnProgressBar);
+
+            //杩涘害鍊兼枃鏈�
+            this.frameProgress = new FrameLayout();
+            frameProgress.Width = Application.GetRealWidth(84);
+            frameProgress.Height = Application.GetRealHeight(60);
+            frameProgress.Y = Application.GetRealHeight(86);
+            frameBack.AddChidren(frameProgress);
+            frameProgress.X = btnProRow.X + btnProgressBar.Right - frameProgress.Width / 2;
+            var btnProgressPic = new PicViewControl(84, 60);
+            btnProgressPic.UnSelectedImagePath = "Item/ProgressMsg.png";
+            frameProgress.AddChidren(btnProgressPic);
+            this.btnProgressView = new NormalViewControl(84, 45, true);
+            btnProgressView.TextSize = 10;
+            btnProgressView.TextAlignment = TextAlignment.Center;
+            btnProgressView.Text = "0%";
+            frameProgress.AddChidren(btnProgressView);
+
+            this.ProRowWidth = btnProRow.Width;
+        }
+
+        #endregion
+
+        #region 鈻� 璁剧疆淇℃伅___________________________
+
+        /// <summary>
+        /// 璁剧疆鏄剧ず淇℃伅
+        /// </summary>
+        /// <param name="msg"></param>
+        public void SetMsg(string msg)
+        {
+            HdlThreadLogic.Current.RunMain(() =>
+            {
+                btnText.Text = msg;
+            });
+        }
+
+        #endregion
+
+        #region 鈻� 璁剧疆杩涘害鍊糭________________________
+
+        /// <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)
+            {
+                return;
+            }
+            HdlThreadLogic.Current.RunMain(() =>
+            {
+                int width = (int)(value * ProRowWidth);
+                btnProgressBar.Width = width;
+                //鏂囨湰鏄剧ず
+                btnProgressView.Text = ((int)(value * 100)) + "%";
+                //鏂囨湰鏄剧ず鐨勯偅涓浘鐗囨绉诲姩
+                frameProgress.X = ControlCommonResourse.XXLeft + btnProgressBar.Right - frameProgress.Width / 2;
+            });
+        }
+
+        #endregion
+
+        #region 鈻� 寮�鍚繘搴︽潯_________________________
+
+        /// <summary>
+        /// 寮�鍚繘搴︽潯
+        /// </summary>
+        public void Start()
+        {
+            if (this.bodyFrameLayout == null)
+            {
+                HdlThreadLogic.Current.RunMain(() =>
+                {
+                    //鍒濆鍖栬繘搴︽潯
+                    this.InitProgressFormBar();
+                });
+            }
+        }
+
+        #endregion
+
+        #region 鈻� 鍏抽棴杩涘害鏉________________________
+
+        /// <summary>
+        /// 鍏抽棴杩涘害鏉�
+        /// </summary>
+        public void Close()
+        {
+            HdlThreadLogic.Current.RunMain(() =>
+            {
+                if (this.oldScrollEnabled == true)
+                {
+                    //濡傛灉瀹冨師鏉ュ氨鏄笉鍙互婊戝姩鐨勮瘽锛屼笉澶勭悊
+                    UserView.HomePage.Instance.ScrollEnabled = true;
+                }
+                Shared.Common.CommonPage.BackKeyCanClick = true;
+                if (this.oldPrigressVisible == true)
+                {
+                    //濡傛灉鍘熸潵鐨勮繘搴︽潯鏄彲瑙佺殑璇�,杩樺師鍥炲幓
+                    Common.CommonPage.Loading.Start(Common.CommonPage.Loading.Text);
+                }
+
+                bodyFrameLayout?.RemoveFromParent();
+                bodyFrameLayout = null;
+                btnText = null;
+                btnProgressView = null;
+                frameProgress = null;
+                btnProgressBar = null;
+                this.MsgClickEvent = null;
+                //鍏抽棴浜嬩欢
+                this.CloseEvent?.Invoke();
+                this.CloseEvent = null;
+            });
+        }
+
+        #endregion
+    }
+}

--
Gitblit v1.8.0