From 66a9965c44ecc32a6696abca876ab9d1cd091584 Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期五, 28 二月 2020 15:25:13 +0800
Subject: [PATCH] 2020.2.28

---
 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/BaseCommonControl/Base/ButtonBase.cs |  108 ++++++++----------------------------------------------
 1 files changed, 16 insertions(+), 92 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/BaseCommonControl/Base/ButtonBase.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/BaseCommonControl/Base/ButtonBase.cs
index 42798c2..52af78a 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/BaseCommonControl/Base/ButtonBase.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/BaseCommonControl/Base/ButtonBase.cs
@@ -30,20 +30,18 @@
                 else { this.SetClickStatu(); }
             }
         }
-
         /// <summary>
-        /// 鏄惁鏄暱鎸夌姸鎬�
+        /// 鍦嗚搴�
         /// </summary>
-        private bool isLongClick = false;
+        public int RadiusEx
+        {
+            set { this.Radius = (uint)Application.GetRealHeight(value); }
+        }
 
         /// <summary>
         /// 鎺т欢鐨勭偣鍑讳簨浠�(鑷畾涔夊皝瑁呬簨浠�,姝や簨浠惰璁ゅ彲涓烘墽琛屾寜閽寜涓嬩簨浠�,鍙桟anClick灞炴�ф帶鍒�)
         /// </summary>
         public Action<Button, MouseEventArgs> ButtonClickEvent = null;
-        /// <summary>
-        /// (鈽呭綋鍓嶄笉瑕佷娇鐢ㄢ槄)鎺т欢鐨勯暱鎸変簨浠�,褰撲簨浠朵负null鏃�,浠h〃闀挎寜缁撴潫(鑷畾涔夊皝瑁呬簨浠�,姝や簨浠惰璁ゅ彲涓烘墽琛屾寜閽暱鎸変簨浠�,鍙桟anClick灞炴�ф帶鍒�)
-        /// </summary>
-        public Action<Button, MouseEventArgs> ButtonLongClickEvent = null;
         /// <summary>
         /// 鎺т欢鐨勬寜涓嬩簨浠�(鑷畾涔夊皝瑁呬簨浠�,姝や簨浠惰璁ゅ彲涓烘墽琛屾寜閽寜涓嬩簨浠�,鍙桟anClick灞炴�ф帶鍒�)
         /// </summary>
@@ -68,8 +66,6 @@
             this.MouseUpEventHandler += ButtonBase_MouseUpEventHandler;
             //鎸変笅浜嬩欢
             this.MouseDownEventHandler += ButtonBase_MouseDownEventHandler;
-            //闀挎寜浜嬩欢
-            this.MouseLongEventHandler += ButtonBase_MouseLongEventHandler;
         }
 
         /// <summary>
@@ -146,15 +142,7 @@
 
                 try
                 {
-                    if (this.isLongClick == false)
-                    {
-                        this.ButtonClickEvent(this, e);
-                    }
-                    else if (ButtonLongClickEvent != null)
-                    {
-                        //闀挎寜缁撴潫
-                        this.ButtonLongClickEvent(this, null);
-                    }
+                    this.ButtonClickEvent(this, e);
                 }
                 catch (Exception ex)
                 {
@@ -165,8 +153,6 @@
                     HdlLogLogic.Current.WriteLog(ex);
                 }
             }
-            //鐘舵�佽繕鍘�
-            this.isLongClick = false;
         }
 
         #endregion
@@ -180,9 +166,6 @@
         /// <param name="e"></param>
         private void ButtonBase_MouseDownEventHandler(object sender, MouseEventArgs e)
         {
-            //杩樺師鐘舵��
-            this.isLongClick = false;
-
             if (CanClick == false || this.ButtonDownClickEvent == null)
             {
                 //涓嶈兘鐐瑰嚮
@@ -200,45 +183,6 @@
                 alert.Show();
                 //Log鍑哄姏
                 HdlLogLogic.Current.WriteLog(ex);
-            }
-        }
-
-        #endregion
-
-        #region 鈻� 闀挎寜浜嬩欢___________________________
-
-        /// <summary>
-        /// 闀挎寜浜嬩欢
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="e"></param>
-        private void ButtonBase_MouseLongEventHandler(object sender, MouseEventArgs e)
-        {
-            //闀挎寜鐘舵��
-            this.isLongClick = true;
-
-            if (ButtonLongClickEvent == null)
-            {
-                this.MouseLongEventHandler -= ButtonBase_MouseLongEventHandler;
-                return;
-            }
-            if (CanClick == true)
-            {
-                //Log鍑哄姏
-                this.WriteLog(1);
-
-                try
-                {
-                    this.ButtonLongClickEvent(this, e);
-                }
-                catch (Exception ex)
-                {
-                    //鍑虹幇鏈煡閿欒
-                    var alert = new ShowMsgControl(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.uUnKnownError));
-                    alert.Show();
-                    //Log鍑哄姏
-                    HdlLogLogic.Current.WriteLog(ex);
-                }
             }
         }
 
@@ -271,7 +215,6 @@
         {
             ButtonClickEvent = null;
             ButtonDownClickEvent = null;
-            ButtonLongClickEvent = null;
 
             base.RemoveFromParent();
         }
@@ -292,38 +235,19 @@
         }
 
         /// <summary>
-        /// 鏍规嵁鏂囨湰,璁$畻瀹冨疄闄呯殑瀹藉害(杩斿洖鐨勬槸鐪熷疄鍊�)
+        /// 鏍规嵁鏂囨湰,璁$畻瀹冨疄闄呯殑瀹藉害
         /// </summary>
-        /// <param name="textSize">瀛椾綋澶у皬,鐪佺暐鏃朵娇鐢ㄥ綋鍓嶆帶浠剁殑瀛椾綋澶у皬</param>
-        /// <param name="i_text">闇�瑕佽绠楃殑鏂囨湰淇℃伅,鐪佺暐鏃朵娇鐢ㄥ綋鍓嶆帶浠剁殑鏂囨湰</param>
         /// <returns></returns>
-        public int GetRealWidthByText(float textSize, string i_text = null)
+        public int GetRealWidthByText()
         {
-            if (i_text == null)
-            {
-                i_text = this.Text;
-            }
-            if (textSize == -1)
-            {
-                textSize = this.TextSize;
-            }
-
-            int byteLength = 0;
-            for (int i = 0; i < i_text.Length; i++)
-            {
-                byteLength += Encoding.UTF8.GetBytes(i_text[i].ToString()).Length;
-                //int length = Encoding.UTF8.GetBytes(i_text[i].ToString()).Length;
-                //if (length == 1)
-                //{
-                //    //鑻辨枃
-                //    byteLength += length;
-                //    continue;
-                //}
-                ////涓枃(鏆傛椂鐢ㄤ腑鏂囧搴�)
-                //byteLength += Encoding.GetEncoding("gb2312").GetBytes(i_text[i].ToString()).Length;
-            }
-            int realWidth = byteLength * (int)textSize;
-            return Application.GetRealWidth(realWidth + 20);
+#if Android
+            //闇�瑕佸鍔犱竴涓宸��
+            return this.GetTextWidth() + Application.GetRealWidth(12);
+#endif
+#if iOS
+            //闇�瑕佸鍔犱竴涓宸��
+            return this.GetTextWidth() + Application.GetRealWidth(25);
+#endif
         }
 
         #endregion

--
Gitblit v1.8.0