From 404cdc88627f942df7944af04ee05b9d527752d6 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期一, 30 九月 2019 13:22:40 +0800
Subject: [PATCH] 合并了徐梅的按键面板绑定

---
 ZigbeeApp/Shared/Phone/UserCenter/Member/MemberListForm.cs |  249 ++++++++++++++++++++++++++-----------------------
 1 files changed, 130 insertions(+), 119 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Member/MemberListForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Member/MemberListForm.cs
index 31e639d..81b3c85 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Member/MemberListForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Member/MemberListForm.cs
@@ -7,18 +7,14 @@
     /// <summary>
     /// 鎴愬憳绠$悊鈽�
     /// </summary>
-    public class MemberListForm : UserCenterCommonForm
+    public class MemberListForm : EditorCommonForm
     {
         #region 鈻� 鍙橀噺澹版槑___________________________
 
         /// <summary>
         /// 鍒楄〃鎺т欢
         /// </summary>
-        private VerticalScrolViewLayout listView = null;
-        /// <summary>
-        /// TopFrameLayout
-        /// </summary>
-        private SpecialFrameLayout specialTopFrame = null;
+        private VerticalListControl listView = null;
 
         #endregion
 
@@ -32,29 +28,26 @@
             //璁剧疆鏍囬淇℃伅
             base.SetTitleText(Language.StringByID(R.MyInternationalizationString.MenberManagement));
 
-            //涓轰簡鑳藉鏄剧ず妯″潡鍥炬牱
-            bodyFrameLayout.BackgroundColor = UserCenterColor.Current.TopFrameLayout;
-
-            var titleIcon = new TopLayoutMostRightView();
+            var titleIcon = new MostRightIconControl(69, 69);
             titleIcon.UnSelectedImagePath = "Item/Add.png";
-            titleIcon.SelectedImagePath = "Item/AddSelected.png";
             topFrameLayout.AddChidren(titleIcon);
-            titleIcon.MouseUpEventHandler += (sender, e) =>
+            titleIcon.InitControl();
+            titleIcon.ButtonClickEvent += (sender, e) =>
             {
                 var menuContr = new TopRightMenuControl(this, 2);
                 //鎵弿浜岀淮鐮�
                 string msg1 = Language.StringByID(R.MyInternationalizationString.uScanQRcode);
-                menuContr.AddRowMenu(msg1, (obj) =>
+                menuContr.AddRowMenu(msg1,"","", () =>
                 {
                     var form = new AddMemberByIdForm();
-                    form.AddForm(form);
+                    form.AddForm();
                 });
                 //杈撳叆璐﹀彿
                 string msg2 = Language.StringByID(R.MyInternationalizationString.uInputAccount);
-                menuContr.AddRowMenu(msg2, (obj) =>
+                menuContr.AddRowMenu(msg2,"","", () =>
                 {
                     var form = new AddMemberByIdForm();
-                    form.AddForm(form);
+                    form.AddForm();
                 });
             };
 
@@ -68,6 +61,9 @@
         /// </summary>
         private void InitMiddleFrame()
         {
+            //娓呯┖bodyFrame
+            this.ClearBodyFrame();
+
             //鍒濆鍖栫敤鎴峰浘鏍�
             this.InitUserIconControl();
 
@@ -87,33 +83,35 @@
         /// </summary>
         private void InitUserIconControl()
         {
-            this.specialTopFrame = new SpecialFrameLayout(400, 10);
-            specialTopFrame.BackgroundColor = UserCenterColor.Current.BodyFrameLayout;
-            bodyFrameLayout.AddChidren(specialTopFrame);
+            var frameBack = new FrameLayout();
+            frameBack.BackgroundColor = UserCenterColor.Current.White;
+            frameBack.Height = Application.GetRealHeight(438);
+            bodyFrameLayout.AddChidren(frameBack);
 
             //鐢ㄦ埛鍥炬爣
-            var btnUserIcon = new ProfilePhotoControl();
-            btnUserIcon.Y = Application.GetRealHeight(40);
+            var btnUserIcon = new PicViewControl(207, 207);
+            btnUserIcon.Y = Application.GetRealHeight(46);
+            btnUserIcon.Radius = (uint)Application.GetMinRealAverage(207) / 2;
             btnUserIcon.Gravity = Gravity.CenterHorizontal;
-            btnUserIcon.UnSelectedImagePath = "Account/Admin.png";
-            specialTopFrame.AddChidren(btnUserIcon);
-
-            //韬唤
-            var btnAuthority = new ViewNormalControl(specialTopFrame.Width);
-            btnAuthority.TextAlignment = TextAlignment.Center;
-            btnAuthority.Y = btnUserIcon.Bottom + Application.GetRealHeight(10);
-            btnAuthority.TextColor = UserCenterColor.Current.TextGrayColor;
-            btnAuthority.Gravity = Gravity.CenterHorizontal;
-            btnAuthority.Text = UserCenterResourse.UserInfo.AuthorityText;
-            specialTopFrame.AddChidren(btnAuthority);
+            btnUserIcon.UnSelectedImagePath = "Center/Admin.png";
+            frameBack.AddChidren(btnUserIcon);
 
             //鏄电О
-            var btnName = new ViewNormalControl(800, true);
+            var btnName = new NormalViewControl(frameBack.Width, Application.GetRealHeight(60), false);
             btnName.TextAlignment = TextAlignment.Center;
-            btnName.Y = btnAuthority.Bottom + Application.GetRealHeight(10);
-            btnName.Gravity = Gravity.CenterHorizontal;
+            btnName.Y = btnUserIcon.Bottom + Application.GetRealHeight(20);
+            btnName.TextSize = 16;
             btnName.Text = UserCenterResourse.UserInfo.UserName; ;
-            specialTopFrame.AddChidren(btnName, HeightAutoMode.IncreaseOnly);
+            frameBack.AddChidren(btnName);
+
+            //韬唤
+            var btnAuthority = new NormalViewControl(frameBack.Width, Application.GetRealHeight(55), false);
+            btnAuthority.TextAlignment = TextAlignment.Center;
+            btnAuthority.Y = btnName.Bottom + Application.GetRealHeight(10);
+            btnAuthority.TextSize = 12;
+            btnAuthority.TextColor = UserCenterColor.Current.TextGrayColor;
+            btnAuthority.Text = UserCenterResourse.UserInfo.AuthorityText;
+            frameBack.AddChidren(btnAuthority);
         }
 
         #endregion
@@ -125,32 +123,24 @@
         /// </summary>
         private void InitMemberListControl()
         {
-            //鍒涘缓涓�涓狥rameLayout
-            var frameLayout = new FrameLayout();
-            frameLayout.Height = bodyFrameLayout.Height - specialTopFrame.Height - Application.GetRealHeight(50);
-            frameLayout.BackgroundColor = UserCenterColor.Current.BodyFrameLayout;
-            frameLayout.Y = this.specialTopFrame.Bottom + Application.GetRealHeight(50);
-            bodyFrameLayout.AddChidren(frameLayout);
-
             //鏍囬:鎴愬憳鍒楄〃
-            var btnMenberTile = new ViewNormalControl(800, true);
+            var btnMenberTile = new NormalViewControl(800, 60, true);
             btnMenberTile.X = ControlCommonResourse.XXLeft;
-            btnMenberTile.Y = Application.GetRealHeight(20);
+            btnMenberTile.Y = Application.GetRealHeight(480);
+            btnMenberTile.TextColor = UserCenterColor.Current.TextColor1;
             btnMenberTile.TextID = R.MyInternationalizationString.MenberList;
-            frameLayout.AddChidren(btnMenberTile);
+            btnMenberTile.TextSize = 15;
+            bodyFrameLayout.AddChidren(btnMenberTile);
 
             //娣诲姞鍙互鍚戜笅婊氬姩鐨勬帶浠�
-            listView = new VerticalScrolViewLayout();
-            listView.Y = btnMenberTile.Bottom + Application.GetRealHeight(20);
-            listView.Height = frameLayout.Height - btnMenberTile.Bottom - Application.GetRealHeight(20);
-            frameLayout.AddChidren(listView);
+            listView = new VerticalListControl(12);
+            listView.Height = bodyFrameLayout.Height - Application.GetRealHeight(567);
+            listView.BackgroundColor = UserCenterColor.Current.White;
+            listView.Y = Application.GetRealHeight(567);
+            bodyFrameLayout.AddChidren(listView);
 
-            new System.Threading.Thread(() =>
-            {
-                //鍒濆鍖栨垚鍛樺垪琛�
-                this.InitMemberList();
-            })
-            { IsBackground = true }.Start();
+            //鍒濆鍖栨垚鍛樺垪琛�
+            this.InitMemberList();
         }
 
         /// <summary>
@@ -162,7 +152,7 @@
             this.ShowProgressBar();
 
             var pra = new MemberListInfoPra();
-            string result = await UserCenterLogic.GetResponseDataByRequestHttps("ZigbeeUsers/GetSubAccountByDistributedMark", pra);
+            string result = await UserCenterLogic.GetResponseDataByRequestHttps("ZigbeeUsers/GetSubAccountByDistributedMark", false, pra);
             if (result == null)
             {
                 //鍏抽棴杩涘害鏉�
@@ -181,27 +171,70 @@
             {
                 //鍏抽棴杩涘害鏉�
                 this.CloseProgressBar(ShowReLoadMode.YES);
+                return;
             }
+            //鍏抽棴杩涘害鏉�
+            this.CloseProgressBar();
+
+            //鍏堟竻绌烘垚鍛樺垪琛ㄤ俊鎭�
+            UserCenterResourse.ListMemberInfo.Clear();
 
             List<string> listCheck = new List<string>();
             foreach (MemberInfoRes infoRes in listInfo)
             {
                 if (listCheck.Contains(infoRes.DistributedMark) == true
                     || infoRes.Account == UserCenterResourse.UserInfo.Phone
-                    || infoRes.Account == UserCenterResourse.UserInfo.Email)
+                    || infoRes.Account == UserCenterResourse.UserInfo.Email
+                    || infoRes.AccountType != 0)
                 {
+                    //濡傛灉鏄畠鑷繁鐨勮瘽,鎴栬�呮潈闄愮瓑绾ф瘮浠栭珮鐨勶紝涓嶆樉绀�
                     continue;
                 }
                 listCheck.Add(infoRes.DistributedMark);
-
-                Application.RunOnMainThread(() =>
-                {
-                    //娣诲姞鎴愬憳琛�
-                    this.AddRowLayout(infoRes);
-                });
+                //娣诲姞鎴愬憳淇℃伅鐨勭紦瀛�
+                UserCenterResourse.ListMemberInfo.Add(infoRes);
             }
-            //鍏抽棴杩涘害鏉�
-            this.CloseProgressBar();
+            listInfo.Clear();
+            //淇濆瓨鎴愬憳淇℃伅鐨勭紦瀛樺埌鏈湴鏂囦欢
+            UserCenterLogic.SaveLocalMemberListInfo();
+            if (UserCenterResourse.ListMemberInfo.Count == 0)
+            {
+                return;
+            }
+
+            //娣诲姞鎴愬憳鍒楄〃
+            this.AddMemberListRowByData();
+        }
+
+        /// <summary>
+        /// 娣诲姞鎴愬憳鍒楄〃
+        /// </summary>
+        private void AddMemberListRowByData()
+        {
+            if (this.Parent == null)
+            {
+                return;
+            }
+            var listNewInfo = UserCenterResourse.ListMemberInfo;
+
+            int count = listNewInfo.Count - 1;
+            for (int i = 0; i < listNewInfo.Count; i++)
+            {
+                //娣诲姞鎴愬憳琛�
+                this.AddRowLayout(listNewInfo[i], i != count);
+            }
+            if (listNewInfo.Count == 0)
+            {
+                return;
+            }
+            //璋冩暣鍒楄〃鎺т欢鐨勯珮搴�
+            var realHeight = listNewInfo.Count * listView.GetChildren(listView.ChildrenCount - 1).Height;
+            realHeight += Application.GetRealHeight(23) - listView.rowSpace + Application.GetRealHeight(23);
+            if (realHeight < listView.Height)
+            {
+                //缂╁皬鎺т欢楂樺害
+                listView.Height = realHeight;
+            }
         }
 
         #endregion
@@ -212,51 +245,47 @@
         /// 娣诲姞鎴愬憳琛�
         /// </summary>
         /// <param name="info">Info.</param>
-        private void AddRowLayout(MemberInfoRes info)
+        ///  <param name="addLine">addLine</param>
+        private void AddRowLayout(MemberInfoRes info, bool addLine)
         {
-            var rowlayout = new MemberRow();
-            rowlayout.AccountId = info.Account;
+            if (listView.ChildrenCount == 0)
+            {
+                //濉炰竴涓┖鐧界殑杩涘幓鍗犵┖闂�
+                var rowTemp = new FrameRowControl();
+                rowTemp.UseClickStatu = false;
+                rowTemp.Height = Application.GetRealHeight(23) - listView.rowSpace;
+                rowTemp.MainKeys = string.Empty;
+                listView.AddChidren(rowTemp);
+            }
+
+            var rowlayout = new FrameRowControl(listView.rowSpace / 2);
+            rowlayout.Height = Application.GetRealHeight(138);
+            rowlayout.MainKeys = info.Account;
             listView.AddChidren(rowlayout);
 
             //鎴愬憳澶村儚鍥炬爣
-            var btnIcon = new IconViewControl();
+            var btnIcon = rowlayout.AddLeftIcon(115);
             btnIcon.Radius = (uint)btnIcon.IconSize / 2;
-            btnIcon.X = ControlCommonResourse.XXLeft;
-            btnIcon.Gravity = Gravity.CenterVertical;
-            btnIcon.UnSelectedImagePath = "Account/ProfilePhotoMember.png";
-            btnIcon.SelectedImagePath = "Account/ProfilePhotoMemberSelected.png";
+            btnIcon.UnSelectedImagePath = "Center/Admin.png";
             rowlayout.AddChidren(btnIcon);
 
             //鎴愬憳鏄电О
-            var btnName = new RowCenterView();
-            btnName.Text = info.UserName;
-            if (string.IsNullOrEmpty(info.UserName) == true)
-            {
-                btnName.Text = info.Account;
-            }
+            string memberName = string.IsNullOrEmpty(info.UserName) == true ? info.Account : info.UserName;
+            var btnName = rowlayout.AddLeftCaption(memberName, 600, true);
+            btnName.TextSize = 15;
             rowlayout.AddChidren(btnName);
 
-            //鏉冮檺
-            var btnAuthority = new RowSecondRightTextView();
-            btnAuthority.TextColor = UserCenterColor.Current.TextGrayColor;
-            if (info.AccountType == 1)
+            if (addLine == true)
             {
-                //绠$悊鍛�
-                btnAuthority.TextID = R.MyInternationalizationString.Administrator;
+                //搴曠嚎
+                rowlayout.AddBottomLine();
             }
-            else
-            {
-                //鎴愬憳
-                btnAuthority.TextID = R.MyInternationalizationString.uMember;
-            }
-            rowlayout.AddChidren(btnAuthority);
-
             //鍙冲浘鏍�
-            rowlayout.AddRightIconControl();
-            rowlayout.MouseUpEvent += (sender, e) =>
+            rowlayout.AddRightArrow();
+            rowlayout.ButtonClickEvent += (sender, e) =>
             {
                 var form = new MemberManagementForm();
-                this.AddForm(form, info);
+                form.AddForm(info);
             };
         }
 
@@ -272,12 +301,12 @@
         {
             for (int i = 0; ; i++)
             {
-                var row = (MemberRow)listView.GetChildren(i);
+                var row = (FrameRowControl)listView.GetChildren(i);
                 if (row == null)
                 {
                     break;
                 }
-                if (row.AccountId == accountId)
+                if (row.MainKeys == accountId)
                 {
                     row.RemoveFromParent();
                     break;
@@ -298,28 +327,10 @@
             HdlShardLogic.Current.ClearShardDirectory();
 
             this.listView.RemoveAll();
+            listView.Height = bodyFrameLayout.Height - Application.GetRealHeight(567);
 
-            new System.Threading.Thread(() =>
-            {
-                //鍒濆鍖栨垚鍛樺垪琛�
-                this.InitMemberList();
-            })
-            { IsBackground = true }.Start();
-        }
-
-        #endregion
-
-        #region 鈻� 缁撴瀯浣揰____________________________
-
-        /// <summary>
-        /// 鑷畾涔夋帶浠�
-        /// </summary>
-        private class MemberRow : StatuRowLayout
-        {
-            /// <summary>
-            /// 璐﹀彿ID
-            /// </summary>
-            public string AccountId = string.Empty;
+            //娣诲姞鎴愬憳鍒楄〃
+            this.AddMemberListRowByData();
         }
 
         #endregion

--
Gitblit v1.8.0