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/CommonForm/CommonFormBase.cs |  142 ++++++++++++++++++++++++++++++++++++----------
 1 files changed, 110 insertions(+), 32 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/CommonForm/CommonFormBase.cs b/ZigbeeApp/Shared/Phone/CommonForm/CommonFormBase.cs
index 6a909a9..4c0881f 100755
--- a/ZigbeeApp/Shared/Phone/CommonForm/CommonFormBase.cs
+++ b/ZigbeeApp/Shared/Phone/CommonForm/CommonFormBase.cs
@@ -143,7 +143,8 @@
         /// </summary>
         /// <param name="gateWay">缃戝叧瀵硅薄</param>
         /// <param name="online">鍦ㄧ嚎鐘舵�佸彉鏇村悗鐨勭姸鎬�</param>
-        public virtual void GatewayOnlinePush(ZigBee.Device.ZbGateway gateWay, bool online)
+        /// <param name="hadGwOnline">2020.05.25杩藉姞:姝や綇瀹呮槸鍚︽嫢鏈夌綉鍏冲湪绾�</param>
+        public virtual void GatewayOnlinePush(ZigBee.Device.ZbGateway gateWay, bool online, bool hadGwOnline)
         {
         }
 
@@ -227,38 +228,10 @@
         /// <param name="msg">淇℃伅</param>
         /// <param name="action">鍗曞嚮纭鍚庢墽琛岀殑鍥炶皟鍑芥暟</param>
         /// <param name="buttonText">鎸夐挳鐨勬枃鏈�</param>
-        public void ShowMassage(ShowMsgType msgType, string msg, Action action = null, string buttonText = null)
+        /// <param name="i_waitTime">绛夊緟鏃堕棿,鍗曚綅涓虹,璁剧疆纭鎸夐挳鍦ㄥ闀挎椂闂村悗鎵嶈兘澶熺偣鍑�</param>
+        public void ShowMassage(ShowMsgType msgType, string msg, Action action = null, string buttonText = null, int i_waitTime = -1)
         {
-            //绌哄璞℃椂锛屼笉鏄剧ず
-            if (string.IsNullOrEmpty(msg))
-            {
-                return;
-            }
-            Application.RunOnMainThread(() =>
-            {
-                var alert = new ShowMsgControl(msgType, msg, buttonText);
-                if (action != null)
-                {
-                    alert.ConfirmClickEvent += () =>
-                    {
-                        try
-                        {
-                            //鍥炶皟鍑芥暟
-                            action?.Invoke();
-                        }
-                        catch (Exception ex)
-                        {
-                            //鍑虹幇鏈煡閿欒,鏁版嵁涓㈠け
-                            this.ShowMassage(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.uUnKnownError));
-
-                            //Log鍑哄姏
-                            HdlLogLogic.Current.WriteLog(ex);
-                        }
-                        action = null;
-                    };
-                }
-                alert.Show();
-            });
+            HdlMessageLogic.Current.ShowMassage(msgType, msg, action, buttonText, i_waitTime);
         }
 
         /// <summary>
@@ -277,8 +250,113 @@
         {
         }
 
+        /// <summary>
+        /// 璁$畻鍥剧墖鐨勭湡瀹為珮瀹藉害
+        /// </summary>
+        /// <param name="i_size"></param>
+        /// <returns></returns>
+        public int GetPictrueRealSize(int i_size)
+        {
+            return HdlControlLogic.Current.GetPictrueRealSize(i_size);
+        }
+
+        /// <summary>
+        /// 璁$畻鐪熷疄瀹藉害(鍙兘浠ュ悗浼氬彉鍔�,鎵�浠ュ0鏄庡嚭鏉ユ湁鐢ㄥ)
+        /// </summary>
+        /// <param name="i_size"></param>
+        /// <returns></returns>
+        public int GetRealWidth(int i_size)
+        {
+            return HdlControlLogic.Current.GetRealWidth(i_size);
+        }
+
+        /// <summary>
+        /// 璁$畻鐪熷疄楂樺害搴�(鍙兘浠ュ悗浼氬彉鍔�,鎵�浠ュ0鏄庡嚭鏉ユ湁鐢ㄥ)
+        /// </summary>
+        /// <param name="i_size"></param>
+        /// <returns></returns>
+        public int GetRealHeight(int i_size)
+        {
+            return HdlControlLogic.Current.GetRealHeight(i_size);
+        }
+
+        /// <summary>
+        /// 璁$畻鐪熷疄澶у皬(杩欎釜涓滆タ鏈夌壒娈婄敤澶�,鑰冭檻鍒板姞闀垮瀷灞忓箷鐨勬帶浠�,璋冪敤姝ゆ柟娉�)
+        /// </summary>
+        /// <param name="i_size"></param>
+        /// <returns></returns>
+        public int GetRealSizeEx(int i_size)
+        {
+            return HdlControlLogic.Current.GetRealSizeEx(i_size);
+        }
+
+        /// <summary>
+        /// 鍒ゆ柇鎸囧畾鐨勭晫闈㈡槸鍚︽墦寮�
+        /// </summary>
+        /// <param name="formId"></param>
+        /// <returns></returns>
+        public bool IsFormOpen(string formId)
+        {
+            return UserCenterResourse.DicActionForm.ContainsKey(formId);
+        }
+
         #endregion
 
+        #region 鈻� 妫�娴嬮敊璇痏__________________________
+
+        /// <summary>
+        /// 妫�娴嬬晫闈㈢殑閿欒
+        /// </summary>
+        /// <returns></returns>
+        public virtual bool CheckForm()
+        {
+            //妫�娴嬫帶浠�
+            return this.CheckControl(this);
+        }
+
+        /// <summary>
+        /// 妫�娴嬫帶浠�
+        /// </summary>
+        /// <param name="view"></param>
+        /// <returns></returns>
+        private bool CheckControl(View view)
+        {
+            //绗竴涓繘鏉ヨ偗瀹氭槸 ViewGroup
+            if (view is ViewGroup)
+            {
+                var viewGroup = (ViewGroup)view;
+                for (int i = 0; i < viewGroup.ChildrenCount; i++)
+                {
+                    var myView = viewGroup.GetChildren(i);
+                    if (myView is ViewGroup)
+                    {
+                        //閫掑綊妫�娴�
+                        bool result = this.CheckControl(myView);
+                        if (result == false)
+                        {
+                            return false;
+                        }
+                        continue;
+                    }
+                    if (myView is TextInputControl)
+                    {
+                        //妫�娴嬭緭鍏ユ鐨勯敊璇�
+                        var error = ((TextInputControl)myView).CheckError();
+                        if (error != null)
+                        {
+                            this.ShowMassage(ShowMsgType.Tip, error);
+                            ((TextInputControl)myView).OnError = true;
+                            return false;
+                        }
+                        ((TextInputControl)myView).OnError = false;
+                    }
+                }
+            }
+            return true;
+        }
+
+        #endregion
+
         #region 鈻� 鍙嶅皠鏂规硶___________________________
 
         /// <summary>

--
Gitblit v1.8.0