From 25429f085093d89d543a0b90e30d0d62d1b7dac9 Mon Sep 17 00:00:00 2001
From: hxb <hxb@hdlchina.com.cn>
Date: 星期二, 30 八月 2022 09:37:38 +0800
Subject: [PATCH] 合并了IOS的代码

---
 ZigbeeApp/Shared/Phone/UserCenter/Member/MemberListForm.cs |  108 +++++++++++++++++++++++++++++++----------------------
 1 files changed, 63 insertions(+), 45 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Member/MemberListForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Member/MemberListForm.cs
index 6e549ec..3075b58 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Member/MemberListForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Member/MemberListForm.cs
@@ -42,7 +42,7 @@
             titleIcon.InitControl();
             titleIcon.ButtonClickEvent += (sender, e) =>
             {
-                var menuContr = new TopRightMenuControl(2, 449);
+                var menuContr = new TopRightMenuControl(2, 2);
                 //鎵弿浜岀淮鐮�
                 string msg1 = Language.StringByID(R.MyInternationalizationString.uScanQRcode);
                 menuContr.AddRowMenu(msg1, "Item/ScanQRcodeIcon.png", "Item/ScanQRcodeIconSelected.png", () =>
@@ -54,8 +54,14 @@
                             return;
                         }
                         //鎼滅储ID
-                        this.SearchMemberInfo(qrCode);
-                    });
+                        HdlThreadLogic.Current.RunThread(() =>
+                        {
+                            this.SearchMemberInfo(qrCode);
+                        });
+                    }, 
+                    Language.StringByID(R.MyInternationalizationString.uCancel),
+                    Language.StringByID(R.MyInternationalizationString.uFlashlamp),
+                    msg1);
                 });
                 //杈撳叆璐﹀彿
                 string msg2 = Language.StringByID(R.MyInternationalizationString.uInputAccount);
@@ -102,9 +108,9 @@
 
             //鐢ㄦ埛鍥炬爣
             var btnUserIcon = new ImageView();
-            btnUserIcon.Height = Application.GetMinRealAverage(207);
-            btnUserIcon.Width = Application.GetMinRealAverage(207);
-            btnUserIcon.Radius = (uint)Application.GetMinRealAverage(207) / 2;
+            btnUserIcon.Height = this.GetPictrueRealSize(207);
+            btnUserIcon.Width = this.GetPictrueRealSize(207);
+            btnUserIcon.Radius = (uint)this.GetPictrueRealSize(207) / 2;
             btnUserIcon.ImagePath = UserCenterResourse.UserInfo.UserIconFile;
             btnUserIcon.Y = Application.GetRealHeight(46);
             btnUserIcon.Gravity = Gravity.CenterHorizontal;
@@ -123,7 +129,7 @@
             btnAuthority.TextAlignment = TextAlignment.Center;
             btnAuthority.Y = btnName.Bottom + Application.GetRealHeight(10);
             btnAuthority.TextSize = 12;
-            btnAuthority.TextColor = UserCenterColor.Current.TextGrayColor;
+            btnAuthority.TextColor = UserCenterColor.Current.TextGrayColor1;
             btnAuthority.Text = UserCenterResourse.UserInfo.AuthorityText;
             frameBack.AddChidren(btnAuthority);
         }
@@ -171,14 +177,14 @@
         /// <summary>
         /// 鍒濆鍖栨垚鍛樺垪琛�
         /// </summary>
-        private async void InitMemberList()
+        private void InitMemberList()
         {
             //寮�鍚繘搴︽潯
             this.ShowProgressBar();
 
             var pra = new MemberListInfoPra();
-            string result = await UserCenterLogic.GetResponseDataByRequestHttps("ZigbeeUsers/GetSubAccountByDistributedMark", false, pra);
-            if (result == null)
+            string result = UserCenterLogic.GetResponseDataByRequestHttps("ZigbeeUsers/GetSubAccountByDistributedMark", false, pra);
+            if (string.IsNullOrEmpty(result) == true)
             {
                 //鍏抽棴杩涘害鏉�
                 this.CloseProgressBar(ShowReLoadMode.YES);
@@ -201,10 +207,8 @@
             //鍏抽棴杩涘害鏉�
             this.CloseProgressBar();
 
-            //鍏堟竻绌烘垚鍛樺垪琛ㄤ俊鎭�
-            UserCenterResourse.ListMemberInfo.Clear();
-
             List<string> listCheck = new List<string>();
+            List<MemberInfoRes> listShowInfo = new List<MemberInfoRes>();
             foreach (MemberInfoRes infoRes in listInfo)
             {
                 if (listCheck.Contains(infoRes.DistributedMark) == true
@@ -222,32 +226,28 @@
 
                 listCheck.Add(infoRes.DistributedMark);
                 //娣诲姞鎴愬憳淇℃伅鐨勭紦瀛�
-                UserCenterResourse.ListMemberInfo.Add(infoRes);
+                listShowInfo.Add(infoRes);
             }
-            listInfo.Clear();
-            //淇濆瓨鎴愬憳淇℃伅鐨勭紦瀛樺埌鏈湴鏂囦欢
-            UserCenterLogic.SaveLocalMemberListInfo();
-            if (UserCenterResourse.ListMemberInfo.Count == 0)
+            if (listShowInfo.Count == 0)
             {
                 return;
             }
             HdlThreadLogic.Current.RunMain(() =>
             {
                 //娣诲姞鎴愬憳鍒楄〃
-                this.AddMemberListRowByData();
+                this.AddMemberListRowByData(listShowInfo);
             });
         }
 
         /// <summary>
         /// 娣诲姞鎴愬憳鍒楄〃
         /// </summary>
-        private void AddMemberListRowByData()
+        private void AddMemberListRowByData(List<MemberInfoRes> listNewInfo)
         {
             if (this.Parent == null)
             {
                 return;
             }
-            var listNewInfo = UserCenterResourse.ListMemberInfo;
 
             int count = listNewInfo.Count - 1;
             for (int i = 0; i < listNewInfo.Count; i++)
@@ -278,13 +278,13 @@
             listView.AddChidren(rowlayout);
 
             //鎴愬憳澶村儚鍥炬爣
-            string iconPath = System.IO.Path.Combine(UserCenterResourse.Option.UserPictruePath, info.DistributedMark + ".png");
+            string iconPath = System.IO.Path.Combine(UserCenterResourse.AccountOption.UserPictruePath, info.DistributedMark + ".png");
             var btnIcon = new ImageView();
             btnIcon.X = ControlCommonResourse.XXLeft;
             btnIcon.Gravity = Gravity.CenterVertical;
-            btnIcon.Height = Application.GetMinRealAverage(115);
-            btnIcon.Width = Application.GetMinRealAverage(115);
-            btnIcon.Radius = (uint)Application.GetMinRealAverage(115) / 2;
+            btnIcon.Height = this.GetPictrueRealSize(115);
+            btnIcon.Width = this.GetPictrueRealSize(115);
+            btnIcon.Radius = (uint)this.GetPictrueRealSize(115) / 2;
             if (System.IO.File.Exists(iconPath) == true)
             {
                 btnIcon.ImagePath = iconPath;
@@ -318,6 +318,23 @@
             };
         }
 
+        /// <summary>
+        /// 娣诲姞鎴愬憳琛�(澶栭儴璋冪敤)
+        /// </summary>
+        /// <param name="info"></param>
+        public void AddRowLayoutByOtherForm(MemberInfoRes info)
+        {
+            var myRow = listView.GetChildren(listView.ChildrenCount - 1);
+            if (myRow != null)
+            {
+                //鏈�鍚庝竴琛屽姞搴曠嚎
+                ((FrameRowControl)myRow).AddBottomLine();
+            }
+            this.AddRowLayout(info, false);
+            //璋冩暣鍒楄〃鎺т欢鐨勯珮搴�
+            listView.AdjustRealHeight(Application.GetRealHeight(23));
+        }
+
         #endregion
 
         #region 鈻� 鑾峰彇鎴愬憳澶村儚_______________________
@@ -331,7 +348,7 @@
             {
                 return;
             }
-            HdlThreadLogic.Current.RunThread(async () =>
+            HdlThreadLogic.Current.RunThread(() =>
             {
                 var pra = new AccountInfoPra();
                 foreach (var keys in dicMemberAccount.Keys)
@@ -341,7 +358,7 @@
                         return;
                     }
                     pra.Account = dicMemberAccount[keys];
-                    var result = await UserCenterLogic.GetByteResponseDataByRequestHttps("ZigbeeUsers/GetSubAccountInfo", false, pra, new List<string>() { "NotSetAgain" });
+                    var result = UserCenterLogic.GetByteResponseDataByRequestHttps("ZigbeeUsers/GetSubAccountInfo", false, pra, new List<string> { "NotCheck" }, false);
                     if (result == null)
                     {
                         continue;
@@ -355,11 +372,11 @@
                     if (infoResult.HeadImage != null)
                     {
                         //鍐欏叆澶村儚鍐呭
-                        string iconPath = System.IO.Path.Combine(UserCenterResourse.Option.UserPictruePath, keys + ".png");
+                        string iconPath = System.IO.Path.Combine(UserCenterResourse.AccountOption.UserPictruePath, keys + ".png");
                         Shared.IO.FileUtils.WriteFileByBytes(iconPath, infoResult.HeadImage);
                         HdlThreadLogic.Current.RunMain(() =>
                         {
-                            dicIconControl[keys].ImagePath = iconPath;
+                            dicIconControl[keys].ImageBytes = Shared.IO.FileUtils.ReadFile(iconPath);
                         });
                     }
                 }
@@ -371,7 +388,7 @@
         #region 鈻� 鍒犻櫎鎸囧畾琛宊________________________
 
         /// <summary>
-        /// 鍒犻櫎鎸囧畾琛�
+        /// 鍒犻櫎鎸囧畾琛�(澶栭儴璋冪敤)
         /// </summary>
         /// <param name="accountId"></param>
         public void DeleteRowByAccount(string accountId)
@@ -386,6 +403,9 @@
                 if (row.MainKeys == accountId)
                 {
                     row.RemoveFromParent();
+                    //璋冩暣鍒楄〃鎺т欢鐨勯珮搴�
+                    listView.AdjustRealHeight(Application.GetRealHeight(23));
+
                     break;
                 }
             }
@@ -400,28 +420,32 @@
         /// </summary>
         /// <param name="accountId">鎴愬憳ID</param>
         /// <param name="txtMsg">淇℃伅鎺т欢</param>
-        private async void SearchMemberInfo(string accountId)
+        private void SearchMemberInfo(string accountId)
         {
             var pra = new AccountInfoPra();
             pra.Account = accountId;
-            string result = await UserCenterLogic.GetResponseDataByRequestHttps("ZigbeeUsers/GetSubAccountInfo", false, pra, new List<string>() { "AccountNoExists" });
-            if (result == null)
+            var byteData = UserCenterLogic.GetByteResponseDataByRequestHttps("ZigbeeUsers/GetSubAccountInfo", false, pra, new List<string>() { "AccountNoExists" });
+            if (byteData == null)
             {
                 //寮傚父
                 return;
             }
-            if (result == string.Empty)
+            var revertObj = Newtonsoft.Json.JsonConvert.DeserializeObject<Common.ResponseEntity.ResponsePack>(System.Text.Encoding.UTF8.GetString(byteData));
+            if (revertObj.StateCode == "AccountNoExists")
             {
-                //鎴愬憳涓嶅瓨鍦�
-                var form = new MemberNotEsixtForm();
-                form.AddForm();
+                HdlThreadLogic.Current.RunMain(() =>
+                {
+                    //鎴愬憳涓嶅瓨鍦�
+                    var form = new MemberNotEsixtForm();
+                    form.AddForm(Language.StringByID(R.MyInternationalizationString.uMemberInformation));
+                });
                 return;
             }
 
-            var infoResult = Newtonsoft.Json.JsonConvert.DeserializeObject<AccountInfoResult>(result);
+            var infoResult = Newtonsoft.Json.JsonConvert.DeserializeObject<AccountInfoResult>(revertObj.ResponseData.ToString());
             infoResult.Account = accountId;
 
-            Application.RunOnMainThread(() =>
+            HdlThreadLogic.Current.RunMain(() =>
             {
                 var form = new AddMemberInfoForm();
                 form.AddForm(infoResult);
@@ -439,12 +463,6 @@
         {
             //娓呯┖鍏变韩鏂囦欢澶�
             HdlShardLogic.Current.ClearShardDirectory();
-
-            this.listView.RemoveAll();
-            listView.Height = bodyFrameLayout.Height - Application.GetRealHeight(567);
-
-            //娣诲姞鎴愬憳鍒楄〃
-            this.AddMemberListRowByData();
 
             return 1;
         }

--
Gitblit v1.8.0