From c6ff92e84b6cb2815cb98065ecb0ecf95d0689c3 Mon Sep 17 00:00:00 2001
From: WJC <wjc@hdlchina.com.cn>
Date: 星期三, 15 一月 2020 09:42:29 +0800
Subject: [PATCH] 2020-01-15-1

---
 ZigbeeApp/Shared/Phone/Device/Logic/MemberList.cs |   77 +++++++++++++++++++++++++++++++-------
 1 files changed, 62 insertions(+), 15 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/MemberList.cs b/ZigbeeApp/Shared/Phone/Device/Logic/MemberList.cs
index c387b1c..58eea86 100644
--- a/ZigbeeApp/Shared/Phone/Device/Logic/MemberList.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/MemberList.cs
@@ -18,7 +18,6 @@
         VerticalRefreshLayout middle;
         CommonDevice common;
         Dictionary<string, string> editdeviceConditionsInfo;
-
         public void Show(CommonDevice commondevice, Dictionary<string, string> editdeviceConditions = null)
         {
             common = commondevice;
@@ -44,6 +43,7 @@
                 Height = Application.GetRealHeight(69),
                 Y = Application.GetRealHeight(92),
                 TextID = MyInternationalizationString.userlist,
+                IsBold = true,
             };
             topRowLayout.AddChidren(titleName);
 
@@ -92,6 +92,7 @@
                     {
                         ///浠庡垪琛ㄧЩ闄ゅ綋鍓嶉棬閿佸叏閮ㄧ殑鏃ф暟鎹紱
                         Send.LockList.Remove(Send.LockList[i]);
+                        i--;
                     }
                 }
                 Read();
@@ -103,7 +104,7 @@
         /// <summary>
         /// 璇诲彇褰撳墠闂ㄩ攣鐨勪簯绔暟鎹紱
         /// </summary>
-        public async void Read()
+        public void Read()
         {
 
             bool d = false;
@@ -118,14 +119,29 @@
                 }
 
             }
+
             CommonPage.Loading.Start();
-            if (!d)
-            {
-                var allMemberslist = await Send.AllMembers(common.DeviceAddr);
-                Send.LockList.AddRange(allMemberslist);
-            }
-            UserList(macport);
-            CommonPage.Loading.Hide();
+            middle.RemoveAll();
+            System.Threading.Tasks.Task.Run(async () =>
+           {
+               try
+               {
+                   if (!d)
+                   {
+                       var allMemberslist = await Send.AllMembers(macport);
+                       Send.LockList.AddRange(allMemberslist);
+                   }
+               }
+               catch { }
+               finally
+               {
+                   Application.RunOnMainThread(() =>
+                   {
+                       CommonPage.Loading.Hide();
+                       UserList(macport);
+                   });
+               }
+           });
         }
         /// <summary>
         /// 鎴愬憳鍒楄〃鐨勬柟娉�
@@ -133,7 +149,6 @@
         /// <param name="macport"></param>
         public void UserList(string macport)
         {
-
             foreach (var user in Send.LockList)
             {
                 if (user.DoorLockMacPort != macport)
@@ -191,7 +206,7 @@
             }
 
 
-        }          
+        }
         /// <summary>
         /// 褰撳墠鎴愬憳淇℃伅鐨勬柟娉�
         /// </summary>
@@ -281,6 +296,13 @@
             string SelectedDeviceStatuscondition = "";
             lockcolorfra1.Y = Application.GetRealHeight(1920 - 140 - (160 * user.UserIdMode.Count) - 20 - 50);
             lockcolorfra1.Height = Application.GetRealHeight(140 + (160 * user.UserIdMode.Count) + 20 + 50);
+            if (user.UserIdMode.Count > 9)
+            {
+                ///鍏冪礌瓒呭嚭10涓紝鏆傛椂榛樿鏄剧ず10;
+                lockcolorfra1.Y = Application.GetRealHeight(1920 - 140 - (160 * 9) - 20 - 50);
+                lockcolorfra1.Height = Application.GetRealHeight(140 + (160 * 9) + 20 + 50);
+            }
+
             for (int i = 0; i < user.UserIdMode.Count; i++)
             {
                 var userifon = user.UserIdMode[i];
@@ -310,6 +332,30 @@
                     TextSize = 14,
                 };
                 doorlockRow.AddChidren(doorlockBtn);
+                if (string.IsNullOrEmpty(doorlockBtn.Text))
+                {
+                    string strname = "";
+                    switch (userifon.OpenMode)
+                    {
+                        case 0:
+                            {
+                                strname = Language.StringByID(MyInternationalizationString.lockpassword);
+                            }
+                            break;
+                        case 3:
+                            {
+                                strname = Language.StringByID(MyInternationalizationString.ic);
+                            }
+                            break;
+                        case 15:
+                            {
+                                strname = Language.StringByID(MyInternationalizationString.fingerprint);
+                            }
+                            break;
+                    }
+                    doorlockBtn.Text = strname + "ID" + userifon.UserId;
+                }
+
 
                 var doorlockSelected = new Button
                 {
@@ -369,7 +415,8 @@
                 deviceConditionsInfo.Add("Range", "0");
                 deviceConditionsInfo.Add("AttriButeId", openMode);
                 deviceConditionsInfo.Add("AttriButeData2", userId);
-                userdictionary.Add("Account", accountname);
+                userdictionary.Add("Account", Config.Instance.Guid);
+                userdictionary.Add("AccountName", accountname);//鐢ㄦ潵鏄剧ず鍚嶇О
                 userdictionary.Add("Type", "1");
                 userdictionary.Add("UserId", userId);
                 if (edit)
@@ -428,9 +475,9 @@
                 {
                     if (!edit)
                     {
-                        var alert = new Alert(Language.StringByID(MyInternationalizationString.Prompt),
-                                               Language.StringByID(MyInternationalizationString.selectdevicestatuscondition),
-                                               Language.StringByID(MyInternationalizationString.complete));
+                        var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal,
+                         Language.StringByID(MyInternationalizationString.selectdevicestatuscondition),
+                         Language.StringByID(MyInternationalizationString.confrim));
                         alert.Show();
                         return;
                     }

--
Gitblit v1.8.0