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/Form/Base/CommonFormBase.cs |  155 ++++++++++++++++++++-------------------------------
 1 files changed, 62 insertions(+), 93 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/Base/CommonFormBase.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/Base/CommonFormBase.cs
index b059beb..7a693a9 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/Base/CommonFormBase.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/Base/CommonFormBase.cs
@@ -28,6 +28,8 @@
         {
             //灏嗗綋鍓嶇殑鐢婚潰淇濆瓨鍒板唴瀛樺綋涓�
             UserCenterLogic.AddActionForm(this);
+            //Log鍑哄姏
+            HdlLogLogic.Current.WriteLog(1, this.FormID + " 鐣岄潰鎵撳紑");
         }
 
         /// <summary>
@@ -70,25 +72,51 @@
         #region 鈻� 鍏抽棴鐣岄潰___________________________
 
         /// <summary>
+        /// 鐢婚潰鍏抽棴涔嬪墠(搴曞眰鍙樻洿,涓嶈兘閲嶈浇CloseForm鏂规硶浜�)
+        /// </summary>
+        public virtual void CloseFormBefore()
+        {
+        }
+
+        /// <summary>
+        /// 鐢婚潰鍏抽棴涔嬪悗(鏂板)
+        /// </summary>
+        public virtual void CloseFormAfter()
+        {
+        }
+
+        /// <summary>
         /// 鐢婚潰鍏抽棴
         /// </summary>
-        public virtual void CloseForm()
+        public void CloseForm()
         {
-            //绉婚櫎鎺ュ彈鍦ㄧ嚎鐘舵�佹帹閫�
-            this.RemoveGatewayOnlinePush();
-            //绉婚櫎璁惧灞炴�у彉鏇存帹閫�
-            this.RemoveDeviceAttributePush();
+            //Log鍑哄姏
+            HdlLogLogic.Current.WriteLog(1, this.FormID + " 鐣岄潰鍏抽棴");
+            try
+            {
+                //鍏抽棴杩涘害鏉�
+                this.CloseProgressBar();
 
-            //鍏抽棴杩涘害鏉�
-            this.CloseProgressBar();
+                //鐢婚潰鍏抽棴涔嬪墠
+                this.CloseFormBefore();
 
-            //璋冪敤鐨勬槸Base鐨勭Щ闄ゆ帶浠跺嚱鏁�
-            //鑰屼笉鏄皟鐢╰his鐨勭Щ闄ゆ帶浠跺嚱
-            base.RemoveFromParent();
+                //璋冪敤鐨勬槸Base鐨勭Щ闄ゆ帶浠跺嚱鏁�
+                //鑰屼笉鏄皟鐢╰his鐨勭Щ闄ゆ帶浠跺嚱
+                base.RemoveFromParent();
 
-            //浠庡垪琛ㄤ腑绉婚櫎(闃叉鐢婚潰浜岄噸娣诲姞)
-            UserCenterLogic.RemoveActionForm(this);
-
+                //浠庡垪琛ㄤ腑绉婚櫎(闃叉鐢婚潰浜岄噸娣诲姞)
+                UserCenterLogic.RemoveActionForm(this);
+
+                //鐢婚潰鍏抽棴涔嬪悗
+                this.CloseFormAfter();
+            }
+            catch (Exception ex)
+            {
+                //鍑虹幇鏈煡閿欒
+                this.ShowMassage(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.uUnKnownError));
+                //Log鍑哄姏
+                HdlLogLogic.Current.WriteLog(ex);
+            }
         }
 
         /// <summary>
@@ -103,30 +131,6 @@
         #endregion
 
         #region 鈻� 缃戝叧鍦ㄧ嚎鐘舵�佹帹閫乢__________________
-
-        /// <summary>
-        /// 璁剧疆缃戝叧鎺ュ彈鍦ㄧ嚎鐘舵�佹帹閫�
-        /// </summary>
-        public void AddGatewayOnlinePush()
-        {
-            for (int i = 0; i < UserCenterResourse.listGatewayOnlinePushForm.Count; i++)
-            {
-                if (this.FormID == UserCenterResourse.listGatewayOnlinePushForm[i].FormID)
-                {
-                    //宸茬粡瀛樺湪,鍒欎笉鍐嶆坊鍔�
-                    return;
-                }
-            }
-            UserCenterResourse.listGatewayOnlinePushForm.Add(this);
-        }
-
-        /// <summary>
-        /// 绉婚櫎缃戝叧鎺ュ彈鍦ㄧ嚎鐘舵�佹帹閫�
-        /// </summary>
-        private void RemoveGatewayOnlinePush()
-        {
-            UserCenterResourse.listGatewayOnlinePushForm.RemoveAll((obj) => { return obj.FormID == this.FormID; });
-        }
 
         /// <summary>
         /// 缃戝叧鍦ㄧ嚎鐘舵�佸彉鏇存帹閫�(鍙湁鍦ㄥ彉鏇寸殑鏃跺�欐墠浼氭帹閫�)
@@ -137,42 +141,6 @@
         {
         }
 
-        #endregion
-
-        #region 鈻� 璁惧灞炴�у彉鏇存帹閫乢__________________
-
-        /// <summary>
-        /// 璁剧疆鎺ュ彈璁惧灞炴�у彉鏇存帹閫�
-        /// </summary>
-        public void AddDeviceAttributePush()
-        {
-            for (int i = 0; i < UserCenterResourse.listDeviceAttributePushForm.Count; i++)
-            {
-                if (this.FormID == UserCenterResourse.listDeviceAttributePushForm[i].FormID)
-                {
-                    //宸茬粡瀛樺湪,鍒欎笉鍐嶆坊鍔�
-                    return;
-                }
-            }
-            UserCenterResourse.listDeviceAttributePushForm.Add(this);
-        }
-
-        /// <summary>
-        /// 绉婚櫎璁惧灞炴�у彉鏇存帹閫�
-        /// </summary>
-        private void RemoveDeviceAttributePush()
-        {
-            UserCenterResourse.listDeviceAttributePushForm.RemoveAll((obj) => { return obj.FormID == this.FormID; });
-        }
-
-        /// <summary>
-        /// 璁惧灞炴�у彉鏇存帹閫�(鍙湁鍦ㄥ彉鏇寸殑鏃跺�欐墠浼氭帹閫�)
-        /// </summary>
-        /// <param name="device">璁惧瀵硅薄</param>
-        public virtual void DeviceAttributePush(ZigBee.Device.CommonDevice device)
-        {
-        }
-
         #endregion
 
         #region 鈻� 鍦嗗舰杩涘害鏉________________________
@@ -242,10 +210,10 @@
         {
         }
 
-        #endregion
+        #endregion
 
         #region 鈻� 涓�鑸殑鏂规硶_________________________
-
+
         /// <summary>
         /// 鏄剧ず淇℃伅妗�
         /// </summary>
@@ -267,8 +235,19 @@
                 {
                     alert.ConfirmClickEvent += () =>
                     {
-                        //鍥炶皟鍑芥暟
-                        action?.Invoke();
+                        try
+                        {
+                            //鍥炶皟鍑芥暟
+                            action?.Invoke();
+                        }
+                        catch (Exception ex)
+                        {
+                            //鍑虹幇鏈煡閿欒,鏁版嵁涓㈠け
+                            this.ShowMassage(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.uUnKnownError));
+
+                            //Log鍑哄姏
+                            HdlLogLogic.Current.WriteLog(ex);
+                        }
                         action = null;
                     };
                 }
@@ -353,14 +332,15 @@
                 {
                     return null;
                 }
-                return form.GetType().InvokeMember(method, System.Reflection.BindingFlags.InvokeMethod, null, form, parameter);
+                var myMethod = form.GetType().GetMethod(method);
+                return myMethod.Invoke(form, parameter);
             }
             catch (Exception ex)
             {
-                string msg = ex.Message + "\r\n";
-                msg += ex.TargetSite.ToString();
-                this.ShowMassage(ShowMsgType.Error, msg);
-
+                //鍑虹幇鏈煡閿欒,鏁版嵁涓㈠け
+                this.ShowMassage(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.uUnKnownError));
+                //Log鍑哄姏
+                HdlLogLogic.Current.WriteLog(ex);
                 return null;
             }
         }
@@ -379,16 +359,5 @@
 
         #endregion
 
-        #region 鈻� 鐣岄潰閲嶆柊婵�娲讳簨浠禵__________________
-
-        /// <summary>
-        /// 鑷韩鐨勪笂灞傜晫闈㈠叧闂悗,瀹冭嚜韬浜庢渶涓婂眰鏃�,瑙﹀彂鐨勪簨浠�
-        /// </summary>
-        public virtual void FormActionAgainEvent()
-        {
-            return;
-        }
-
-        #endregion
     }
 }

--
Gitblit v1.8.0