From dc0309e64f02227d8e1468b7326c07955f804612 Mon Sep 17 00:00:00 2001
From: chenqiyang <1406175257@qq.com>
Date: 星期三, 22 六月 2022 11:22:18 +0800
Subject: [PATCH] 修改引用路径

---
 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/InformationEditorControl.cs |  242 ++++++++++++++++++++++++++++++++----------------
 1 files changed, 161 insertions(+), 81 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/InformationEditorControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/InformationEditorControl.cs
old mode 100755
new mode 100644
index fc1c8a2..ef53d2a
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/InformationEditorControl.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/CompoundControls/InformationEditorControl.cs
@@ -1,81 +1,161 @@
-锘縰sing System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace Shared.Phone.UserCenter
-{
-    /// <summary>
-    /// 淇℃伅缂栬緫鎺т欢(涓嶅缓璁埆浜轰娇鐢�)
-    /// </summary>
-    public class InformationEditorControl
-    {
-        /// <summary>
-        /// 鍒濆鍖栨帶浠�(杩斿洖鐨勬槸淇℃伅瀹瑰櫒鎺т欢)
-        /// </summary>
-        /// <param name="bodyFrameLayout">bodyFrameLayout</param>
-        /// <param name="title">鏍囬鏂囨湰</param>
-        /// <param name="Y">bodyFrameLayout閲岄潰鐨刌杞村潗鏍�</param>
-        /// <param name="Height">钃濇箹UI閲岄潰瀹冪殑楂樺害</param>
-        /// <returns>淇℃伅瀹瑰櫒鎺т欢</returns>
-        public VerticalListControl InitControl(FrameLayout bodyFrameLayout, string title, int Y, int Height)
-        {
-            //寮у害鐨勫渾鐨勪竴鍗婄殑楂樺害(鍥哄畾)
-            int halfRoundHeigth = Application.GetRealHeight(116) / 2;
-            //寮у害鐨勫渾
-            var btnRound = new NormalViewControl(bodyFrameLayout.Width, halfRoundHeigth * 2, false);
-            btnRound.Y = Application.GetRealHeight(Y);
-            btnRound.BackgroundColor = UserCenterColor.Current.White;
-            btnRound.Radius = (uint)halfRoundHeigth;
-            bodyFrameLayout.AddChidren(btnRound);
-            //鏄庣粏鍒楄〃鐨勬甯冿紝鐧借壊鑳屾櫙(瑕嗙洊寮у害鐨勫渾鐨勫崐杈�)
-            var detailBackFrame = new FrameLayout();
-            detailBackFrame.Y = btnRound.Bottom - btnRound.Height / 2;
-            detailBackFrame.Height = Application.GetRealHeight(Height);//楂樺害灏辨槸瑕佸畠瓒呰繃
-            detailBackFrame.BackgroundColor = UserCenterColor.Current.White;
-            bodyFrameLayout.AddChidren(detailBackFrame);
-
-            //淇℃伅缂栬緫
-            var btnTile = new NormalViewControl(800, 60, true);
-            btnTile.X = ControlCommonResourse.XXLeft;
-            btnTile.TextSize = 15;
-            btnTile.TextColor = UserCenterColor.Current.TextColor2;
-            btnTile.Text = title;
-            detailBackFrame.AddChidren(btnTile);
-
-            var listview = new VerticalListControl(12);
-            listview.Y = btnTile.Bottom + Application.GetRealHeight(17);
-            listview.Height = Application.GetRealHeight(Height) - halfRoundHeigth - btnTile.Bottom - Application.GetRealHeight(17);
-            detailBackFrame.AddChidren(listview);
-
-            return listview;
-        }
-
-        /// <summary>
-        /// 瀹屾垚鍒濆鍖�(褰撹鏁板鐨勬椂鍊�,杩欎釜鍑芥暟寰堟湁鐢ㄣ�傝鏁颁笉瓒呰繃瀹瑰櫒鏃讹紝璋冧笉璋冪敤杩欎釜鍑芥暟閮芥病浜�)
-        /// </summary>
-        /// <param name="bodyFrameLayout">bodyFrameLayout</param>
-        /// <param name="listview">瀹瑰櫒鎺т欢</param>
-        public void FinishInitControl(FrameLayout bodyFrameLayout, VerticalListControl listview)
-        {
-            var btnFinish = new BottomClickButton();
-            //鍊熺敤Y杞村潗鏍�(璁╄繖涓尯鍩熶笉鑳界偣鍑昏彍鍗�)
-            //var frameBack = new FrameLayout();
-            //frameBack.Y = btnFinish.Yaxis;
-            //frameBack.Height = bodyFrameLayout.Height - btnFinish.Yaxis;
-            //bodyFrameLayout.AddChidren(frameBack);
-
-            if (listview.ChildrenCount > 0)
-            {
-                var realHeight = listview.GetChildren(0).Height * listview.ChildrenCount;
-                if (bodyFrameLayout.Height - btnFinish.Yaxis + realHeight > listview.Height)
-                {
-                    //淇冧娇琚尅浣忕殑鑿滃崟鑳藉鍚戜笂婊戝姩
-                    var frameTemp = new FrameLayout();
-                    //frameTemp.Height = frameBack.Height + Application.GetRealHeight(115);
-                    frameTemp.Height = bodyFrameLayout.Height - btnFinish.Yaxis + Application.GetRealHeight(115);
-                    listview.AddChidren(frameTemp);
-                }
-            }
-        }
-    }
-}
+锘縰sing System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Shared.Phone.UserCenter
+{
+    /// <summary>
+    /// 淇℃伅缂栬緫鎺т欢(涓嶅缓璁埆浜轰娇鐢�)
+    /// </summary>
+    public class InformationEditorControl
+    {
+        #region 鈻� 鍙橀噺澹版槑___________________________
+
+        /// <summary>
+        /// 鏄庣粏鍒楄〃鐨勬甯冿紝鐧借壊鑳屾櫙
+        /// </summary>
+        private FrameLayout detailBackFrame = null;
+        /// <summary>
+        /// 鍒楄〃鎺т欢
+        /// </summary>
+        private FrameListControl listview = null;
+        /// <summary>
+        /// 鏈�灏忛珮搴�
+        /// </summary>
+        private int minHeight = -1;
+
+        #endregion
+
+        #region 鈻� 鍒濆鍖朹____________________________
+
+        /// <summary>
+        /// 鍒濆鍖栨帶浠�(杩斿洖鐨勬槸淇℃伅瀹瑰櫒鎺т欢)
+        /// </summary>
+        /// <param name="bodyFrameLayout">鐖舵帶浠�</param>
+        /// <param name="title">鏍囬鏂囨湰</param>
+        /// <param name="Height">钃濇箹UI閲岄潰瀹冪殑楂樺害</param>
+        /// <param name="real">鏄惁璁$畻Height鐨勭湡瀹炲��</param>
+        /// <returns>淇℃伅瀹瑰櫒鎺т欢</returns>
+        public FrameListControl InitControl(FrameLayout bodyFrameLayout, string title, int Height, bool real = true)
+        {
+            if (real == true) { Height = Application.GetRealHeight(Height); }
+            //鏄庣粏鍒楄〃鐨勬甯冿紝鐧借壊鑳屾櫙
+            this.detailBackFrame = new FrameLayout();
+            detailBackFrame.Height = Height;
+            detailBackFrame.BackgroundColor = UserCenterColor.Current.White;
+            detailBackFrame.SetCornerWithSameRadius(Application.GetRealHeight(58), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight);
+            detailBackFrame.Gravity = Gravity.BottomCenter;
+            bodyFrameLayout.AddChidren(detailBackFrame);
+            this.minHeight = detailBackFrame.Height;
+
+            //淇℃伅缂栬緫
+            var btnTile = new NormalViewControl(800, 60, true);
+            btnTile.X = ControlCommonResourse.XXLeft;
+            btnTile.Y = Application.GetRealHeight(81);
+            btnTile.TextSize = 15;
+            btnTile.TextColor = UserCenterColor.Current.TextColor2;
+            btnTile.Text = title;
+            detailBackFrame.AddChidren(btnTile);
+
+            //鍒楄〃鎺т欢
+            this.listview = new FrameListControl(12);
+            listview.Y = btnTile.Bottom + Application.GetRealHeight(17);
+            listview.Height = Height - btnTile.Bottom - Application.GetRealHeight(17);
+            detailBackFrame.AddChidren(listview);
+
+            return listview;
+        }
+
+        /// <summary>
+        /// 瀹屾垚鍒濆鍖�
+        /// </summary>
+        /// <param name="HadBottomButton">杩欎釜鎺т欢鎵�鍦ㄧ殑鐣岄潰,搴曢儴鏈夋病鏈変繚瀛樻寜閽�</param>
+        /// <param name="mandatoryAdjustment">寮哄埗璋冩暣楂樺害</param>
+        public void FinishInitControl(bool HadBottomButton = true, bool mandatoryAdjustment = false)
+        {
+            if (HadBottomButton == true)
+            {
+                var btnFinish = new BottomClickButton();
+                //璁╁畠鍒敼鍙樺潗鏍�
+                int tempSpace = listview.rowSpace;
+                listview.rowSpace = 0;
+                //淇冧娇琚尅浣忕殑鑿滃崟鑳藉鍚戜笂婊戝姩
+                var frameTemp = new FrameLayout();
+                frameTemp.Height = ControlCommonResourse.BodyFrameHeight - btnFinish.Yaxis + Application.GetRealHeight(23);
+                listview.AddChidren(frameTemp);
+
+                listview.rowSpace = tempSpace;
+            }
+
+            //璋冩暣瀹瑰櫒楂樺害澶у皬
+            int value = this.GetLocationMostLastViewBottom();
+            if (mandatoryAdjustment == false)
+            {
+                if (value + Application.GetRealHeight(23) < listview.Height)
+                {
+                    //涓嶉渶瑕佽皟鏁�
+                    return;
+                }
+            }
+            //璋冩暣澶у皬
+            listview.Height = value + Application.GetRealHeight(23);
+
+            int backHeigth = listview.Bottom;
+            if (minHeight > backHeigth)
+            {
+                //瀹冩湁涓渶灏忛珮搴�
+                backHeigth = minHeight;
+            }
+            this.detailBackFrame.Height = backHeigth;
+
+            //鑾峰彇listview鎵�鍦ㄧ殑鍏ㄥ眬瀹瑰櫒鎺т欢
+            var contrFather = GetVerticalFrameControl(listview);
+            //璋冩暣妗屽竷澶у皬
+            contrFather?.AdjustTableHeight();
+        }
+
+        #endregion
+
+        #region 鈻� 涓�鑸柟娉昣__________________________
+
+        /// <summary>
+        /// 鑾峰彇listview鎵�鍦ㄧ殑鍏ㄥ眬瀹瑰櫒鎺т欢
+        /// </summary>
+        /// <param name="listview"></param>
+        /// <returns></returns>
+        private VerticalFrameControl GetVerticalFrameControl(FrameListControl listview)
+        {
+            var myContr = listview.Parent;
+            while (myContr != null)
+            {
+                if (myContr is VerticalFrameControl)
+                {
+                    return (VerticalFrameControl)myContr;
+                }
+                myContr = myContr.Parent;
+            }
+            return null;
+        }
+
+        /// <summary>
+        /// 鑾峰彇鍧愭爣搴曢儴鏈�涓嬮潰鐨勯偅涓帶浠剁殑搴曢儴鍧愭爣
+        /// </summary>
+        /// <returns></returns>
+        private int GetLocationMostLastViewBottom()
+        {
+            int bottomHeight = -1;
+
+            for (int i = 0; i < this.listview.ChildrenCount; i++)
+            {
+                var child = this.listview.GetChildren(i);
+                if (child.Bottom > bottomHeight)
+                {
+                    bottomHeight = child.Bottom;
+                }
+            }
+            return bottomHeight;
+        }
+
+        #endregion
+    }
+}

--
Gitblit v1.8.0