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/FrameLayoutControls/FrameLayoutControl.cs |  131 ++++++++++++++++++++++++++++++++++++-------
 1 files changed, 108 insertions(+), 23 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/FrameLayoutControls/FrameLayoutControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/FrameLayoutControls/FrameLayoutControl.cs
index 1041b41..bab9c6a 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/FrameLayoutControls/FrameLayoutControl.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/FrameLayoutControls/FrameLayoutControl.cs
@@ -24,6 +24,10 @@
         /// </summary>
         public bool UseClickStatu = true;
         /// <summary>
+        /// 鑳藉惁鐐瑰嚮
+        /// </summary>
+        public bool CanClick = true;
+        /// <summary>
         /// 鍘熸潵鐨勮儗鏅壊
         /// </summary>
         private uint oldBackColor = 0;
@@ -35,6 +39,13 @@
         /// 瀛愭帶浠禮杞村亸绉婚噺(鍏遍�氬畾涔夎�屽凡)
         /// </summary>
         public int chidrenYaxis = 0;
+        /// <summary>
+        /// 鍦嗚搴�
+        /// </summary>
+        public int RadiusEx
+        {
+            set { this.Radius = (uint)Application.GetRealHeight(value); }
+        }
 
         #endregion
 
@@ -50,7 +61,7 @@
 
             this.MouseUpEventHandler += ChildrenUpEvent;
             this.MouseDownEventHandler += ChildrenDownEvent;
-        }
+        }
 
         #endregion
 
@@ -63,14 +74,21 @@
         /// <param name="chidrenBindMode">鍙樻洿鐨勭粦瀹氭ā寮�</param>
         public void ChangedChidrenBindMode(View view, ChidrenBindMode chidrenBindMode)
         {
-            if (view is Button)
+            if (view is ButtonBase)
             {
                 //瀛愭帶浠剁Щ闄や簨浠�
-                Button button = (Button)view;
-                button.MouseUpEventHandler -= ChildrenUpEvent;
+                ButtonBase button = (ButtonBase)view;
+                button.ButtonClickEvent -= ChildrenUpEvent;
                 button.MouseDownEventHandler -= ChildrenDownEvent;
 
                 this.BindChidrenEvent(view, chidrenBindMode);
+            }
+            else if (view is ImageView)
+            {
+                view.MouseUpEventHandler -= ChildrenUpEvent;
+                view.MouseDownEventHandler -= ChildrenDownEvent;
+
+                this.BindChidrenEvent(view, chidrenBindMode);
             }
             else if (view is ViewGroup)
             {
@@ -82,11 +100,11 @@
                     {
                         break;
                     }
-                    if (myView is Button)
+                    if (myView is ButtonBase)
                     {
                         //瀛愭帶浠剁Щ闄や簨浠�
-                        Button button = (Button)myView;
-                        button.MouseUpEventHandler -= ChildrenUpEvent;
+                        ButtonBase button = (ButtonBase)myView;
+                        button.ButtonClickEvent -= ChildrenUpEvent;
                         button.MouseDownEventHandler -= ChildrenDownEvent;
                     }
                 }
@@ -105,17 +123,30 @@
         /// <param name="chidrenBindMode"></param>
         private void BindChidrenEvent(View view, ChidrenBindMode chidrenBindMode)
         {
-            if (view is Button && chidrenBindMode != ChidrenBindMode.NotBind)
+            if (chidrenBindMode == ChidrenBindMode.NotBind)
+            {
+                return;
+            }
+            if (view is ButtonBase)
             {
                 //涓哄瓙鎺т欢娣诲姞浜嬩欢
-                Button button = (Button)view;
-                button.MouseUpEventHandler -= ChildrenUpEvent;
+                ButtonBase button = (ButtonBase)view;
+                button.ButtonClickEvent -= ChildrenUpEvent;
                 button.MouseDownEventHandler -= ChildrenDownEvent;
 
-                button.MouseUpEventHandler += ChildrenUpEvent;
+                button.ButtonClickEvent += ChildrenUpEvent;
                 button.MouseDownEventHandler += ChildrenDownEvent;
             }
-            else if (view is ViewGroup && chidrenBindMode != ChidrenBindMode.NotBind)
+            else if (view is ImageView)
+            {
+                //鑷韩涔熸坊鍔犱簨浠�
+                view.MouseUpEventHandler -= ChildrenUpEvent;
+                view.MouseDownEventHandler -= ChildrenDownEvent;
+
+                view.MouseUpEventHandler += ChildrenUpEvent;
+                view.MouseDownEventHandler += ChildrenDownEvent;
+            }
+            else if (view is ViewGroup)
             {
                 //涓哄瓙鎺т欢娣诲姞浜嬩欢
                 ViewGroup groupContr = (ViewGroup)view;
@@ -126,14 +157,14 @@
                     {
                         break;
                     }
-                    if (myView is Button)
+                    if (myView is ButtonBase)
                     {
                         //涓哄瓙鎺т欢娣诲姞浜嬩欢
-                        Button button = (Button)myView;
-                        button.MouseUpEventHandler -= ChildrenUpEvent;
+                        ButtonBase button = (ButtonBase)myView;
+                        button.ButtonClickEvent -= ChildrenUpEvent;
                         button.MouseDownEventHandler -= ChildrenDownEvent;
 
-                        button.MouseUpEventHandler += ChildrenUpEvent;
+                        button.ButtonClickEvent += ChildrenUpEvent;
                         button.MouseDownEventHandler += ChildrenDownEvent;
                     }
                 }
@@ -163,7 +194,6 @@
 
             //缁戝畾瀛愭帶浠朵簨浠�
             this.BindChidrenEvent(view, chidrenBindMode);
-
         }
 
         #endregion
@@ -177,7 +207,7 @@
         /// <param name="e">E.</param>
         private void ChildrenDownEvent(object sender, MouseEventArgs e)
         {
-            if (this.UseClickStatu == false)
+            if (this.UseClickStatu == false|| this.CanClick == false)
             {
                 return;
             }
@@ -191,8 +221,29 @@
         /// <param name="e">E.</param>
         private void ChildrenUpEvent(object sender, MouseEventArgs e)
         {
-            //璋冪敤濮旀墭
-            ButtonClickEvent?.Invoke(sender, e);
+            if (this.CanClick == false)
+            {
+                //涓嶅厑璁哥偣鍑�
+                return;
+            }
+            if (sender is FrameLayoutControl)
+            {
+                //LOG鍑哄姏
+                this.WriteLog();
+            }
+            try
+            {
+                //璋冪敤濮旀墭
+                ButtonClickEvent?.Invoke(sender, e);
+            }
+            catch (Exception ex)
+            {
+                //鍑虹幇鏈煡閿欒
+                var alert = new ShowMsgControl(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.uUnKnownError));
+                alert.Show();
+                //Log鍑哄姏
+                HdlLogLogic.Current.WriteLog(ex);
+            }
         }
 
         #endregion
@@ -247,7 +298,7 @@
 
             //璁剧疆閫夋嫨鐘舵��
             this.SetClickSelectStatu();
-            new System.Threading.Thread(() =>
+            HdlThreadLogic.Current.RunThread(() =>
             {
                 System.Threading.Thread.Sleep(waiTime);
                 Application.RunOnMainThread(() =>
@@ -255,8 +306,7 @@
                     //璁剧疆涓嶉�夋嫨鐘舵��
                     this.SetClickNotSelectStatu();
                 });
-            })
-            { IsBackground = true }.Start();
+            });
         }
 
         /// <summary>
@@ -280,5 +330,40 @@
         }
 
         #endregion
+
+        #region 鈻� Log鍑哄姏____________________________
+
+        /// <summary>
+        /// 璇ユ帶浠舵墍灞炵殑鐣岄潰鍚嶅瓧
+        /// </summary>
+        private string formName = 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;
+                }
+            }
+            HdlLogLogic.Current.WriteLog(1, formName + ".FrameLayoutControl 琚偣鍑�");
+        }
+
+        #endregion
     }
 }

--
Gitblit v1.8.0