From 05ce435c3b58e53eeab04c672affdeeab75f3036 Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期五, 15 十一月 2019 14:41:39 +0800
Subject: [PATCH] 2019.11.15-1

---
 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/BaseCommonControl/Base/ButtonBase.cs |   99 ++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 88 insertions(+), 11 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 74b9849..9427cee 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/BaseCommonControl/Base/ButtonBase.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/BaseCommonControl/Base/ButtonBase.cs
@@ -124,7 +124,21 @@
             }
             if (CanClick == true)
             {
-                this.ButtonClickEvent?.Invoke(this, e);
+                //Log鍑哄姏
+                this.WriteLog();
+
+                try
+                {
+                    this.ButtonClickEvent?.Invoke(this, e);
+                }
+                catch (Exception ex)
+                {
+                    //鍑虹幇鏈煡閿欒
+                    var alert = new ShowMsgControl(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.uUnKnownError));
+                    alert.Show();
+                    //Log鍑哄姏
+                    HdlLogLogic.Current.WriteLog(ex);
+                }
             }
         }
 
@@ -204,18 +218,81 @@
             int byteLength = 0;
             for (int i = 0; i < i_text.Length; i++)
             {
-                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;
+                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);
+            return Application.GetRealWidth(realWidth + 20);
+        }
+
+        /// <summary>
+        /// 娣诲姞搴曢儴闃村奖鐗规晥(纭繚鎷ユ湁鐖舵帶浠跺悗鎵嶈皟鐢�)
+        /// </summary>
+        public void AddBottomShadow()
+        {
+            var btnShadow = new PicViewControl(this.Width, Application.GetMinRealAverage(45), false);
+            btnShadow.X = this.X;
+            btnShadow.Y = this.Bottom;
+            btnShadow.UnSelectedImagePath = "Item/BottomShadow.png";
+            this.Parent.AddChidren(btnShadow);
+        }
+
+        #endregion
+
+        #region 鈻� Log鍑哄姏____________________________
+
+        /// <summary>
+        /// 璇ユ帶浠舵墍灞炵殑鐣岄潰鍚嶅瓧
+        /// </summary>
+        private string formName = null;
+        /// <summary>
+        /// 鎺т欢鍚嶅瓧
+        /// </summary>
+        private string controlName = null;
+
+        /// <summary>
+        /// Log鍑哄姏
+        /// </summary>
+        private void WriteLog()
+        {
+            if (formName == null)
+            {
+                formName = string.Empty;
+                View myView = this.Parent;
+                for (; ; )
+                {
+                    if (myView == null)
+                    {
+                        break;
+                    }
+                    else if (myView is CommonFormBase)
+                    {
+                        //杩欎釜鎺т欢鎵�灞炵殑鐣岄潰
+                        formName = ((CommonFormBase)myView).FormID;
+                        break;
+                    }
+                    myView = myView.Parent;
+                }
+                if (string.IsNullOrEmpty(this.Text) == false)
+                {
+                    //杩欎釜鎺т欢鐨勬枃鏈�
+                    controlName = this.Text;
+                }
+                else
+                {
+                    //濡傛灉娌℃湁鏂囨湰鐨勮瘽,瀹冨簲璇ユ槸涓�寮犲浘鐗�
+                    controlName = this.UnSelectedImagePath;
+                }
+            }
+            HdlLogLogic.Current.WriteLog(1, formName + "鐨刐" + controlName + "]鎸夐敭琚偣鍑�");
         }
 
         #endregion

--
Gitblit v1.8.0