From c7df85937f73fb347ee0b19e9c052d2d00a6df6c Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期五, 18 九月 2020 13:58:19 +0800
Subject: [PATCH] 新版本

---
 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/MessageControls/ShowMsgControl.cs |   91 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 90 insertions(+), 1 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/MessageControls/ShowMsgControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/MessageControls/ShowMsgControl.cs
index af99766..a0dcd82 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/MessageControls/ShowMsgControl.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/MessageControls/ShowMsgControl.cs
@@ -42,6 +42,10 @@
         /// 鎻愮ず鎺т欢
         /// </summary>
         private Tip myTip = null;
+        /// <summary>
+        /// 绛夊緟鏃堕棿
+        /// </summary>
+        private int WaitTime = -1;
 
         #endregion
 
@@ -54,13 +58,15 @@
         /// <param name="i_msg">淇℃伅</param>
         /// <param name="i_buttonOkText">纭鎸夐挳鐨勬枃鏈�</param>
         /// <param name="i_buttonCancelText">鍙栨秷鎸夐挳鐨勬枃鏈�</param>
-        public ShowMsgControl(ShowMsgType i_msgType, string i_msg, string i_buttonOkText = null, string i_buttonCancelText = null)
+        /// <param name="i_waitTime">绛夊緟鏃堕棿,鍗曚綅涓虹,璁剧疆纭鎸夐挳鍦ㄥ闀挎椂闂村悗鎵嶈兘澶熺偣鍑�</param>
+        public ShowMsgControl(ShowMsgType i_msgType, string i_msg, string i_buttonOkText = null, string i_buttonCancelText = null, int i_waitTime = -1)
         {
             //纭鎸夐挳鏂囨湰
             this.buttonOkText = i_buttonOkText == null ? Language.StringByID(R.MyInternationalizationString.OkMsg) : i_buttonOkText;
             this.buttonCancelText = i_buttonCancelText == null ? Language.StringByID(R.MyInternationalizationString.uCancel) : i_buttonCancelText;
             this.msgType = i_msgType;
             this.msgText = i_msg;
+            this.WaitTime = i_waitTime;
 
             if (i_msgType == ShowMsgType.Tip)
             {
@@ -207,6 +213,8 @@
                 this.ConfirmClickEvent = null;
                 this.CancelClickEvent = null;
             };
+            //寮�鍚瓑寰呮椂闂�
+            this.StartWaitTime(btnConfirm);
         }
 
         /// <summary>
@@ -280,6 +288,87 @@
                 this.ConfirmClickEvent = null;
             };
 #endif
+            //寮�鍚瓑寰呮椂闂�
+            this.StartWaitTime(btnConfirm);
+        }
+
+        #endregion
+
+        #region 鈻� 寮�鍚瓑寰呮椂闂確______________________
+
+        /// <summary>
+        /// 寮�鍚瓑寰呮椂闂�(姝ゅ嚱鏁板彧鐢ㄤ簬瀹夊崜)
+        /// </summary>
+        /// <param name="btnConfirm">纭鎸夐挳</param>
+        private void StartWaitTime(BottomRightClickButton btnConfirm)
+        {
+            if (this.WaitTime <= 0)
+            {
+                return;
+            }
+
+            btnConfirm.CanClick = false;
+            HdlThreadLogic.Current.RunThread(() =>
+            {
+                //鏄剧ず鍓╀綑绛夊緟鏃堕棿
+                while (btnConfirm.Parent != null && this.WaitTime >= 0)
+                {
+                    HdlThreadLogic.Current.RunMain(() =>
+                    {
+                        btnConfirm.SetButtonText(this.buttonOkText + "(" + this.WaitTime + ")");
+                    }, ShowErrorMode.NO);
+                    System.Threading.Thread.Sleep(1000);
+                    this.WaitTime--;
+                }
+                HdlThreadLogic.Current.RunMain(() =>
+                {
+                    //鍙互鐐瑰嚮
+                    btnConfirm.SetButtonText(this.buttonOkText);
+                    btnConfirm.CanClick = true;
+                }, ShowErrorMode.NO);
+            });
+        }
+
+        /// <summary>
+        /// 寮�鍚瓑寰呮椂闂�
+        /// </summary>
+        /// <param name="btnConfirm">纭鎸夐挳</param>
+        private void StartWaitTime(ButtonBase btnConfirm)
+        {
+            if (this.WaitTime <= 0)
+            {
+                return;
+            }
+#if Android
+            ((FrameLayoutStatuControl)btnConfirm.Parent).CanClick = false;
+#endif
+#if iOS
+            btnConfirm.CanClick = false;
+#endif
+            HdlThreadLogic.Current.RunThread(() =>
+            {
+                //鏄剧ず鍓╀綑绛夊緟鏃堕棿
+                while (btnConfirm.Parent != null && this.WaitTime >= 0)
+                {
+                    HdlThreadLogic.Current.RunMain(() =>
+                    {
+                        btnConfirm.Text = this.buttonOkText + "(" + this.WaitTime + ")";
+                    }, ShowErrorMode.NO);
+                    System.Threading.Thread.Sleep(1000);
+                    this.WaitTime--;
+                }
+                HdlThreadLogic.Current.RunMain(() =>
+                {
+                    //鍙互鐐瑰嚮
+                    btnConfirm.Text = this.buttonOkText;
+#if Android
+                    ((FrameLayoutStatuControl)btnConfirm.Parent).CanClick = true;
+#endif
+#if iOS
+                    btnConfirm.CanClick = true;
+#endif
+                }, ShowErrorMode.NO);
+            });
         }
 
         #endregion

--
Gitblit v1.8.0