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/DoorLock/UndistributeDoorlockUserPage.cs | 1122 ++++++++++++++++++++++++++++------------------------------
 1 files changed, 536 insertions(+), 586 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UndistributeDoorlockUserPage.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UndistributeDoorlockUserPage.cs
index 4efd8ca..7084a3a 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UndistributeDoorlockUserPage.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UndistributeDoorlockUserPage.cs
@@ -4,7 +4,7 @@
 using ZigBee.Device;
 namespace Shared.Phone.UserCenter.DoorLock
 {
-    public class UndistributeDoorlockUserPage : DoorLockCommonLayout, ZigBee.Common.IStatus
+    public class UndistributeDoorlockUserPage : DoorLockCommonLayout
     {
         /// <summary>
         /// 鏋勯�犲嚱鏁�
@@ -17,113 +17,57 @@
             BackgroundColor = Shared.Common.ZigbeeColor.Current.GXCTopViewBackgroundColor;
         }
 
-        #region 鈼� 鍙橀噺鐢虫槑__________________________
+        #region 鍙橀噺鐢虫槑 
+        /// <summary>
+        /// 褰撳墠闂ㄩ攣
+        /// </summary>
         ZigBee.Device.DoorLock doorLock;
+        /// <summary>
+        /// 搴曢儴鐧借壊甯冨眬
+        /// </summary>
         FrameLayout bottomFrameLayout;
+        /// <summary>
+        /// 褰撳墠绫诲瀷
+        /// </summary>
         string currentType = string.Empty;
+        /// <summary>
+        /// 鏈湴璐︽埛鍒楄〃
+        /// </summary>
         List<Shared.Phone.UserCenter.MemberInfoRes> localAccountList;
-        VerticalScrolViewLayout bodyView;
+        /// <summary>
+        /// 婊戝姩甯冨眬View
+        /// </summary>
+        VerticalListRefreshControl bodyView;
+        /// <summary>
+        /// 鏄惁浜屾鍒犻櫎
+        /// </summary>
+        bool isSecondDel;
+        /// <summary>
+        /// 淇濆瓨涔嬪墠鎼滅储鍒版湰鍦伴棬閿佺敤鎴峰垪琛�
+        /// </summary>
+        Dictionary<int, DoorLockCommonInfo.LocaDoorLockObj> oldLocalDoorLockUserList = new Dictionary<int, DoorLockCommonInfo.LocaDoorLockObj>();
         #endregion
 
+        /// <summary>
+        /// 鑾峰彇鎵�鏈夎处鎴风殑闂ㄩ攣鐢ㄦ埛鍒楄〃
+        /// </summary>
         void ReadDoorLockUserInfo()
         {
             System.Threading.Tasks.Task.Run(async () =>
             {
-                Application.RunOnMainThread(() => { CommonPage.Loading.Start("Loading..."); });
                 try
                 {
-                    var getDoorLockInfo = await doorLock.GetDoorlockUserInfoAsync();
-                    if (getDoorLockInfo != null && getDoorLockInfo.doorLockUserDetailData != null)
+                    var list = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetDoorLockAllAcountUserlist(doorLock);
+                    if (oldLocalDoorLockUserList.Count != 0)
                     {
-                        var dataList = getDoorLockInfo.doorLockUserDetailData.UserObjList;
-                        foreach (var doorData in dataList)
+                        //濡傛灉鏈娌℃湁鎼滅储鍒帮紝鎻愮ず缃戝叧娌℃湁鍥炲
+                        if (list.Count == 0)
                         {
-                            var localDoorLockObj1 = new ZigBee.Device.DoorLock.LocaDoorLockObj()
+                            Application.RunOnMainThread(() =>
                             {
-                                UserID = doorData.UserId,
-                                UnlockType = doorData.UserType
-                            };
-                            if ((doorLock.localDoorLockUserList.ContainsKey(localDoorLockObj1.UserID)) == false)
-                            {
-                                doorLock.localDoorLockUserList.Add(localDoorLockObj1.UserID, localDoorLockObj1);
-                            }
+                                new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance);
+                            });
                         }
-
-                        //  璇诲彇浜戠闂ㄩ攣璁惧涓殑淇℃伅
-                        var localDoorLockObj = new ZigBee.Device.DoorLock.GetDoorLockData() { };
-
-                        foreach (var curAccountObj in doorLock.localAllAccountList)
-                        {
-                            if (UserCenterResourse.UserInfo.AuthorityNo != 1)
-                            {
-                                localDoorLockObj.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
-                                localDoorLockObj.IsOtherAccountCtrl = true;
-                            }
-                            localDoorLockObj.CloudAccountId = curAccountObj.SubAccountDistributedMark;
-                            if (doorLock.DeviceAddr != null)
-                            {
-                                localDoorLockObj.DoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint;
-                            }
-                            var getDoorLockInfoList = await ZigBee.Device.DoorLock.GetDoorLockInfoFromServer("DoorLock/GetDoorLockPager", localDoorLockObj);
-                            if (getDoorLockInfoList != null)
-                            {
-                                foreach (var curDoorLockUser in getDoorLockInfoList.PageData)
-                                {
-                                    if (curDoorLockUser.DoorLockLocalUserId == null || curDoorLockUser.DoorLockLocalUserId == "")
-                                    {
-                                        continue;
-                                    }
-                                    if (doorLock.localDoorLockUserList.ContainsKey(int.Parse(curDoorLockUser.DoorLockLocalUserId)))
-                                    {
-                                        var doorLockObj = new ZigBee.Device.DoorLock.LocaDoorLockObj() { };
-                                        doorLockObj.UserID = int.Parse(curDoorLockUser.DoorLockLocalUserId);
-                                        doorLockObj.UnlockType = curDoorLockUser.OpenLockMode;
-                                        doorLockObj.PrimaryId = curDoorLockUser.Id;
-                                        doorLockObj.EntryTime = curDoorLockUser.EntryTime;
-                                        doorLockObj.UserName = curDoorLockUser.UserIdRemarks;
-                                        doorLockObj.ConnectedAccount = curDoorLockUser.CloudAccountId;
-                                        doorLock.localDoorLockUserList[int.Parse(curDoorLockUser.DoorLockLocalUserId)] = doorLockObj;
-                                    }
-                                    else
-                                    {
-                                        if (curDoorLockUser.DoorLockLocalUserId != null)
-                                        {
-                                            //闂ㄩ攣涓病鏈夛紝浜戠鏈夌敤鎴稩D锛屽悗鍙板垹闄や簯绔繖浜汭D
-                                            var deleteDoorLockData = new ZigBee.Device.DoorLock.DeleteDoorLockData();
-                                            if (UserCenterResourse.UserInfo.AuthorityNo != 1)
-                                            {
-                                                deleteDoorLockData.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
-                                                deleteDoorLockData.IsOtherAccountCtrl = true;
-                                            }
-                                            if (doorLock.DeviceAddr != null)
-                                            {
-                                                deleteDoorLockData.DoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint;
-                                            }
-                                            deleteDoorLockData.DoorLockLocalUserId = curDoorLockUser.DoorLockLocalUserId;
-                                            deleteDoorLockData.PrimaryId = curDoorLockUser.Id;
-                                            deleteDoorLockData.DelDoorLockDelType = 2;
-                                            var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/DelDoorLock", deleteDoorLockData);
-                                            int i = 0;
-                                        }
-                                    }
-                                }
-                            }
-                            else
-                            {
-                                Application.RunOnMainThread(() =>
-                                {
-                                    new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.CloudServerResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(this.btnTip);
-                                    return;
-                                });
-                            }
-                        }
-                    }
-                    else
-                    {
-                        Application.RunOnMainThread(() =>
-                        {
-                            new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(this.btnTip);
-                        });
                     }
                 }
                 catch { }
@@ -131,32 +75,48 @@
                 {
                     Application.RunOnMainThread(() =>
                     {
-                        MidFrameLayoutContent();
+                        UndateUnlockMethodAction += (obj) =>
+                        {
+                            RefreshList(obj);
+                        };
+                        TypeRefresh(doorLock);
                         CommonPage.Loading.Hide();
+                        bodyView.EndHeaderRefreshing();
                     });
                 }
             });
         }
 
-        /// <summary>
-        /// UI鏄剧ず
+        /// <summary>
+        /// UI鏄剧ず
         /// </summary>
         public void Show()
         {
+            doorLock.currentUserDisplayMethod = "";
             this.TopFrameLayout(this, Language.StringByID(R.MyInternationalizationString.UndistributedUnlockMethod));
             this.btnTitleLine.Visible = false;
             EventHandler<MouseEventArgs> eHandlerBack = (sender, e) =>
             {
                 RemoveFromParent();
-                this.btnTip.Visible = false;
             };
             this.btnBack.MouseUpEventHandler += eHandlerBack;
             this.btnBackFrameLayout.MouseUpEventHandler += eHandlerBack;
             this.MidFrameLayout(this);
-
-            ReadDoorLockUserInfo();
+            MidFrameLayoutContent();
+            if (doorLock.localDoorLockUserList.Count == 0)
+            {
+                CommonPage.Loading.Start("Loading...");
+                ReadDoorLockUserInfo();
+            }
+            else
+            {
+                RefreshList();
+            }
         }
 
+        /// <summary>
+        /// 涓儴甯冨眬
+        /// </summary>
         public void MidFrameLayoutContent()
         {
             var midTopFrameLayout = new FrameLayout()
@@ -172,12 +132,41 @@
                 Width = Application.GetRealWidth(141 + 100),
                 Y = Application.GetRealHeight(35),
                 X = Application.GetRealWidth(812 - 100),
-                TextAlignment = TextAlignment.Center,
-                Text = Language.StringByID(R.MyInternationalizationString.LockMethod),
-                TextColor = Shared.Common.ZigbeeColor.Current.XMTopTitleText,
+                TextAlignment = TextAlignment.CenterRight,
+                TextColor = Shared.Common.ZigbeeColor.Current.XMBlack,
                 TextSize = 12,
+                IsBold = true,
             };
             midTopFrameLayout.AddChidren(btnAllMethod);
+            // 绫诲瀷鍖哄垎 
+            if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.AllMethod))
+            {
+                btnAllMethod.Text = Language.StringByID(R.MyInternationalizationString.AllMethod);
+            }
+            else if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.PasswordUnlock))
+            {
+                btnAllMethod.Text = Language.StringByID(R.MyInternationalizationString.PasswordUnlock);
+            }
+            else if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.FingerprintUnlock))
+            {
+                btnAllMethod.Text = Language.StringByID(R.MyInternationalizationString.FingerprintUnlock);
+            }
+            else if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.ProximithCardUnlock))
+            {
+                btnAllMethod.Text = Language.StringByID(R.MyInternationalizationString.ProximithCardUnlock);
+            }
+            else if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.FaceIDUnlock))
+            {
+                btnAllMethod.Text = Language.StringByID(R.MyInternationalizationString.FaceIDUnlock);
+            }
+            else if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.CalmFingerprintUnlock))
+            {
+                btnAllMethod.Text = Language.StringByID(R.MyInternationalizationString.CalmFingerprintUnlock);
+            }
+            else
+            {
+                btnAllMethod.Text = Language.StringByID(R.MyInternationalizationString.AllMethod);
+            }
 
             var btnNext = new Button()
             {
@@ -189,10 +178,16 @@
                 SelectedImagePath = "DoorLock/UnLockSideslipIcon.png",
             };
             midTopFrameLayout.AddChidren(btnNext);
-            btnNext.MouseUpEventHandler += (sender, e) =>
+            EventHandler<MouseEventArgs> handerSideLip = (sender, e) =>
             {
-                SideslipFramelayout();
+                SideslipFramelayout(doorLock);
+                UndateUnlockMethodAction += (obj) =>
+                {
+                    RefreshList(obj);
+                };
             };
+            btnNext.MouseUpEventHandler += handerSideLip;
+            btnAllMethod.MouseUpEventHandler += handerSideLip;
 
             var btnLine = new Button
             {
@@ -202,23 +197,33 @@
             };
             this.midFrameLayout.AddChidren(btnLine);
 
-            bodyView = new VerticalScrolViewLayout()
+            bodyView = new VerticalListRefreshControl()
             {
-                Y = midTopFrameLayout.Bottom,
+                Y = btnLine.Bottom,
                 Height = Application.GetRealHeight(1921 - 184 - 115 - 1),
             };
             this.midFrameLayout.AddChidren(bodyView);
-
-            RefreshList();
+            bodyView.BeginHeaderRefreshingAction += () =>
+            {
+                bodyView.BeginHeaderRefreshing();
+                ReadDoorLockUserInfo();
+            };
         }
 
-        void RefreshList()
+        /// <summary>
+        /// 鍒锋柊鍒楄〃
+        /// </summary>
+        void RefreshList(int unlockMethod = -1)
         {
+            this.midFrameLayout.RemoveAll();
+            MidFrameLayoutContent();
             bodyView.RemoveAll();
+            var curLocalDoorLockUserList = new Dictionary<int, DoorLockCommonInfo.LocaDoorLockObj>();
+
             foreach (var curUserId in doorLock.localDoorLockUserList.Keys)
             {
                 var curDoorLockUser = doorLock.localDoorLockUserList[curUserId];
-                if (curDoorLockUser.ConnectedAccount != "")
+                if (!string.IsNullOrEmpty(curDoorLockUser.ConnectedAccount))
                 {
                     continue;
                 }
@@ -226,104 +231,287 @@
                 {
                     continue;
                 }
-                var RowView = new FrameLayout()
-                {
-                    Height = Application.GetRealHeight(161),
-                    BackgroundColor = Shared.Common.ZigbeeColor.Current.XMWhite,
-                };
-                bodyView.AddChidren(RowView);
+                curLocalDoorLockUserList.Add(curUserId, curDoorLockUser);
+            }
 
-                var btnDistributeUnlockIconFrameLayout = new FrameLayout()
-                {
-                    Height = Application.GetRealHeight(84),
-                    Width = Application.GetRealWidth(84),
-                    X = Application.GetRealWidth(58),
-                    Y = Application.GetRealHeight(43),
-                };
-                RowView.AddChidren(btnDistributeUnlockIconFrameLayout);
-
-                var btnDistributeUnlockIcon = new Button()
-                {
-                    Height = Application.GetRealHeight(84),
-                    Width = Application.GetRealWidth(84),
-                    UnSelectedImagePath = "DoorLock/DistributeUnlockIcon.png",
-                };
-                btnDistributeUnlockIconFrameLayout.AddChidren(btnDistributeUnlockIcon);
-
-                var btnText = new Button()
-                {
-                    X = Application.GetRealWidth(176),
-                    Width = Application.GetRealWidth(300),
-                    Height = Application.GetRealHeight(300),
-                    TextAlignment = TextAlignment.CenterLeft,
-                    TextColor = Shared.Common.ZigbeeColor.Current.XMBlack,
-                    Gravity = Gravity.CenterVertical,
-                };
-                RowView.AddChidren(btnText);
-
-                var line2 = new Button()
-                {
-                    Y = RowView.Height - 1,
-                    X = Application.GetRealWidth(58),
-                    Width = Application.GetRealWidth(965),
-                    Height = 1,
-                    BackgroundColor = Shared.Common.ZigbeeColor.Current.XMRowLine,
-                };
-                RowView.AddChidren(line2);
-
-                #region 鏁版嵁澶勭悊
-                switch (curDoorLockUser.UnlockType)
+            int i = 0;
+            foreach (var curUserId in curLocalDoorLockUserList.Keys)
+            {
+                oldLocalDoorLockUserList = curLocalDoorLockUserList;
+                var curDoorLockUser = curLocalDoorLockUserList[curUserId];
+                switch (unlockMethod)
                 {
                     case 0:
-                        if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null)
+                        if (curDoorLockUser.UnlockType != unlockMethod)
                         {
-                            btnText.Text = curDoorLockUser.UserName;
-                        }
-                        else
-                        {
-                            btnText.Text = Language.StringByID(R.MyInternationalizationString.Password) + "ID" + curDoorLockUser.UserID;
+                            continue;
                         }
                         break;
                     case 3:
-                        if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null)
+                        if (curDoorLockUser.UnlockType != unlockMethod)
                         {
-                            btnText.Text = curDoorLockUser.UserName;
+                            continue;
                         }
-                        else
+                        break;
+                    case 13:
+                        if (curDoorLockUser.UnlockType != unlockMethod)
                         {
-                            btnText.Text = Language.StringByID(R.MyInternationalizationString.IcCard) + "ID" + curDoorLockUser.UserID;
+                            continue;
+                        }
+                        break;
+                    case 14:
+                        if (curDoorLockUser.UnlockType != unlockMethod)
+                        {
+                            continue;
                         }
                         break;
                     case 15:
-                        if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null)
+                        if (curDoorLockUser.UnlockType != unlockMethod)
                         {
-                            btnText.Text = curDoorLockUser.UserName;
+                            continue;
+                        }
+                        break;
+                    default:
+                        break;
+                }
+
+                var rowFrameLayout = new RowLayoutControl(bodyView.rowSpace / 2);
+                rowFrameLayout.BackgroundColor = ZigbeeColor.Current.XMWhite;
+                bodyView.AddChidren(rowFrameLayout);
+                rowFrameLayout.frameTable.UseClickStatu = false;
+                var btnicon = rowFrameLayout.frameTable.AddLeftIcon();
+                btnicon.UnSelectedImagePath = "DoorLock/DistributeUnlockIcon.png";
+
+                string cText = "";
+                switch (curDoorLockUser.UnlockType)
+                {
+                    case 0:
+                        if (!string.IsNullOrEmpty(curDoorLockUser.UserName))
+                        {
+                            cText = curDoorLockUser.UserName;
                         }
                         else
                         {
-                            btnText.Text = Language.StringByID(R.MyInternationalizationString.Fingerprint) + "ID" + +curDoorLockUser.UserID;
+                            cText = Language.StringByID(R.MyInternationalizationString.Password) + "ID" + curDoorLockUser.UserID;
+                        }
+                        break;
+                    case 3:
+                        if (!string.IsNullOrEmpty(curDoorLockUser.UserName))
+                        {
+                            cText = curDoorLockUser.UserName;
+                        }
+                        else
+                        {
+                            cText = Language.StringByID(R.MyInternationalizationString.IcCard) + "ID" + curDoorLockUser.UserID;
+                        }
+                        break;
+                    case 13:
+                        if (!string.IsNullOrEmpty(curDoorLockUser.UserName))
+                        {
+                            cText = curDoorLockUser.UserName;
+                        }
+                        else
+                        {
+                            cText = Language.StringByID(R.MyInternationalizationString.CalmFingerprintMark) + "ID" + +curDoorLockUser.UserID;
+                        }
+                        break;
+                    case 14:
+                        if (!string.IsNullOrEmpty(curDoorLockUser.UserName))
+                        {
+                            cText = curDoorLockUser.UserName;
+                        }
+                        else
+                        {
+                            cText = Language.StringByID(R.MyInternationalizationString.FaceIDMark) + "ID" + +curDoorLockUser.UserID;
+                        }
+                        break;
+                    case 15:
+                        if (!string.IsNullOrEmpty(curDoorLockUser.UserName))
+                        {
+                            cText = curDoorLockUser.UserName;
+                        }
+                        else
+                        {
+                            cText = Language.StringByID(R.MyInternationalizationString.Fingerprint) + "ID" + +curDoorLockUser.UserID;
                         }
                         break;
                 }
+                var btnText = rowFrameLayout.frameTable.AddLeftCaption(cText, 800);
+
+                //鍒犻櫎
+                var btndelete = rowFrameLayout.AddDeleteControl();
+                btndelete.ButtonClickEvent += (sender, e) =>
+                {
+                    string msg = Language.StringByID(R.MyInternationalizationString.SureToDelUnlockMethod);
+                    var alert = new Shared.Phone.UserCenter.ShowMsgControl(ShowMsgType.Confirm, msg, Language.StringByID(R.MyInternationalizationString.DoorlockConfirm));
+                    alert.Show();
+                    //浣跨敤纭鍨嬪脊妗嗘椂,鐨勫洖璋冨嚱鏁�
+                    alert.ConfirmClickEvent += async () =>
+                    {
+                        try
+                        {
+                            CommonPage.Loading.Start("");
+                            var passData = doorLock.SetUserAccessData(curDoorLockUser.UserID, ZigBee.Device.DoorLock.AccessType.DelCurrentUser);
+                            var resultData = await doorLock.DefaultControlAsync(passData);
+                            if (resultData != null && resultData.defaultControlResponseData != null)
+                            {
+                                if (resultData.defaultControlResponseData.status == 0 || resultData.defaultControlResponseData.status == 2)
+                                {
+                                    var deleteDoorLockData = new ZigBee.Device.DoorLock.DeleteDoorLockData();
+                                    if (UserCenterResourse.UserInfo.AuthorityNo != 1)
+                                    {
+                                        deleteDoorLockData.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
+                                        deleteDoorLockData.IsOtherAccountCtrl = true;
+                                    }
+                                    if (doorLock.DeviceAddr != null)
+                                    {
+                                        deleteDoorLockData.DoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint;
+                                    }
+                                    deleteDoorLockData.DoorLockLocalUserId = curDoorLockUser.UserID.ToString();
+                                    deleteDoorLockData.PrimaryId = curDoorLockUser.PrimaryId;
+                                    deleteDoorLockData.DelDoorLockDelType = 2;
+                                    var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/DelDoorLock", deleteDoorLockData);
+                                    if (result != null)
+                                    {
+                                        if (result.StateCode == "Success")
+                                        {
+                                            isSecondDel = false;
+                                            if (doorLock.localDoorLockUserList.ContainsKey(curDoorLockUser.UserID))
+                                            {
+                                                doorLock.localDoorLockAccountList.Remove(curDoorLockUser.ConnectedAccount);
+                                                var localDoorLockObj = new ZigBee.Device.DoorLock.LocaDoorLockObj() { };
+                                                localDoorLockObj.UserID = curDoorLockUser.UserID;
+                                                doorLock.localDoorLockUserList.Remove(curUserId);
+                                                doorLock.ReSave();
+                                                UndateUnlockMethodAction += (obj) =>
+                                                {
+                                                    RefreshList(obj);
+                                                };
+                                                TypeRefresh(doorLock);
+                                            }
+                                        }
+                                        else
+                                        {
+                                            //寮�鍏冲浘鏍�
+                                            new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.RemoveFailed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnText);
+                                        }
+                                    }
+                                    else
+                                    {
+                                        isSecondDel = true;
+                                        new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.CloudServerResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnText);
+                                    }
+                                }
+                                else
+                                {
+                                    if (isSecondDel)
+                                    {
+                                        var deleteDoorLockData = new ZigBee.Device.DoorLock.DeleteDoorLockData();
+                                        if (UserCenterResourse.UserInfo.AuthorityNo != 1)
+                                        {
+                                            deleteDoorLockData.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
+                                            deleteDoorLockData.IsOtherAccountCtrl = true;
+                                        }
+                                        if (doorLock.DeviceAddr != null)
+                                        {
+                                            deleteDoorLockData.DoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint;
+                                        }
+                                        deleteDoorLockData.DoorLockLocalUserId = curDoorLockUser.UserID.ToString();
+                                        deleteDoorLockData.PrimaryId = curDoorLockUser.PrimaryId;
+                                        deleteDoorLockData.DelDoorLockDelType = 2;
+                                        var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/DelDoorLock", deleteDoorLockData);
+                                        if (result != null)
+                                        {
+                                            if (result.StateCode == "Success")
+                                            {
+                                                isSecondDel = false;
+                                                if (doorLock.localDoorLockUserList.ContainsKey(curDoorLockUser.UserID))
+                                                {
+                                                    doorLock.localDoorLockUserList.Remove(curDoorLockUser.UserID);
+                                                    var localDoorLockObj = new ZigBee.Device.DoorLock.LocaDoorLockObj() { };
+                                                    localDoorLockObj.UserID = curDoorLockUser.UserID;
+                                                    doorLock.localDoorLockUserList.Remove(curUserId);
+                                                    UndateUnlockMethodAction += (obj) =>
+                                                    {
+                                                        RefreshList(obj);
+                                                    };
+                                                    TypeRefresh(doorLock);
+                                                }
+                                            }
+                                            else
+                                            {
+                                                new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.RemoveFailed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnText);
+                                            }
+                                        }
+                                        else
+                                        {
+                                            isSecondDel = true;
+                                            new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.CloudServerResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnText);
+                                        }
+                                    }
+                                    else
+                                    {
+                                        if (curDoorLockUser.UserID < 10)
+                                        {
+                                            new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.OnlyBeDeletedOnTheDevice), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnText);
+                                        }
+                                        else
+                                        {
+                                            new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.RemoveFailed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnText);
+                                        }
+                                    }
+                                }
+                            }
+                            else
+                            {
+                                new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 2 }.Show(CommonPage.Instance);
+                            }
+                        }
+                        catch { }
+                        finally
+                        {
+                            CommonPage.Loading.Hide();
+                        }
+                    };
+                };
+
+                var line2 = new Button()
+                {
+                    Y = rowFrameLayout.Height - 1,
+                    X = Application.GetRealWidth(176),
+                    Width = Application.GetRealWidth(847),
+                    Height = 1,
+                    BackgroundColor = Shared.Common.ZigbeeColor.Current.XMRowLine,
+                };
+                rowFrameLayout.AddChidren(line2);
+
+                #region 鏁版嵁澶勭悊
+                int currentIndex = i;
+                if (currentIndex == curLocalDoorLockUserList.Keys.Count - 1)
+                {
+                    line2.Visible = false;
+                }
+
 
                 EventHandler<MouseEventArgs> eHandler = (sender, e) =>
                 {
                     MatchUsersFrameLayout(curDoorLockUser);
                 };
-                btnDistributeUnlockIcon.MouseUpEventHandler += eHandler;
-                btnDistributeUnlockIconFrameLayout.MouseUpEventHandler += eHandler;
-                RowView.MouseUpEventHandler += eHandler;
+                rowFrameLayout.MouseUpEventHandler += eHandler;
                 btnText.MouseUpEventHandler += eHandler;
                 #endregion
+                i++;
             }
         }
 
-        //鏈湴璐︽埛
+        /// <summary>
+        /// 鍒嗛厤鏈湴璐︽埛
+        /// </summary> 
         void MatchUsersFrameLayout(ZigBee.Device.DoorLock.LocaDoorLockObj curDoorLockUser)
         {
             #region  UI
             FrameLayout flMain = new FrameLayout { BackgroundColor = 0x0f000000 };
-            this.midFrameLayout.AddChidren(flMain);
+            this.AddChidren(flMain);
             flMain.MouseUpEventHandler += (sender11, e11) =>
             {
                 flMain.RemoveFromParent();
@@ -332,24 +520,24 @@
             bottomFrameLayout = new FrameLayout()
             {
                 Height = Application.GetRealHeight(100),
-                Y = Application.GetRealHeight(930),
-                Radius = 17,
+                Y = Application.GetRealHeight(1253),
+                Radius = (uint)Application.GetRealHeight(100 / 2),
                 BackgroundColor = ZigbeeColor.Current.XMWhite,
             };
             flMain.AddChidren(bottomFrameLayout);
 
             var bottomFrameLayout1 = new FrameLayout()
             {
-                Height = Application.GetRealHeight(806 - 50),
-                Y = Application.GetRealHeight(930 + 48),
+                Height = Application.GetRealHeight(668 - 60),
+                Y = Application.GetRealHeight(1253 + 58),
                 BackgroundColor = ZigbeeColor.Current.XMWhite,
             };
             flMain.AddChidren(bottomFrameLayout1);
 
             var bottomFrameLayout2 = new FrameLayout()
             {
-                Height = Application.GetRealHeight(806),
-                Y = Application.GetRealHeight(930),
+                Height = Application.GetRealHeight(668),
+                Y = Application.GetRealHeight(1253),
             };
             flMain.AddChidren(bottomFrameLayout2);
 
@@ -373,33 +561,35 @@
 
             var btnMatchUser = new Button
             {
-                X = Application.GetRealWidth(446),
+                X = Application.GetRealWidth(159),
                 Y = Application.GetRealHeight(35),
                 Height = Application.GetRealHeight(63),
-                Width = Application.GetRealWidth(284),
-                Text = Language.StringByID(R.MyInternationalizationString.MatchPerson),
+                Width = Application.GetRealWidth(762),
+                Text = Language.StringByID(R.MyInternationalizationString.MatchUser),
                 TextColor = Shared.Common.ZigbeeColor.Current.XMBlack,
                 TextSize = 16,
+                TextAlignment = TextAlignment.Center,
             };
             matchUsersFrameLayout.AddChidren(btnMatchUser);
 
             var btnFinish = new Button
             {
-                X = Application.GetRealWidth(919),
+                X = Application.GetRealWidth(921),
                 Y = Application.GetRealHeight(40),
                 Height = Application.GetRealHeight(58),
-                Width = Application.GetRealWidth(101),
+                Width = Application.GetRealWidth(101 + 81),
                 Text = Language.StringByID(R.MyInternationalizationString.Complete),
-                TextColor = Shared.Common.ZigbeeColor.Current.XMGray3,
+                TextColor = Shared.Common.ZigbeeColor.Current.XMOrange,
                 TextSize = 14,
+                TextAlignment = TextAlignment.CenterLeft,
             };
             matchUsersFrameLayout.AddChidren(btnFinish);
 
             var btnTopLine = new FrameLayout()
             {
-                Height = Application.GetRealHeight(5),
+                Height = 1,
                 Y = Application.GetRealHeight(138),
-                BackgroundColor = Shared.Common.ZigbeeColor.Current.XMGray3,
+                BackgroundColor = Shared.Common.ZigbeeColor.Current.XMRowLine,
             };
             bottomFrameLayout2.AddChidren(btnTopLine);
 
@@ -436,8 +626,8 @@
 
                 var btnChoose = new Button()
                 {
-                    Width = Application.GetRealWidth(60),
-                    Height = Application.GetRealHeight(60),
+                    Width = Application.GetMinRealAverage(60),
+                    Height = Application.GetMinRealAverage(60),
                     X = Application.GetRealWidth(861 + 81),
                     Y = Application.GetRealHeight(35),
                     SelectedImagePath = "DoorLock/SelectedIcon.png",
@@ -462,7 +652,7 @@
                     btnLine.Visible = false;
                 }
 
-                if (currentAccount.UserName != "" && currentAccount.UserName != null)
+                if (!string.IsNullOrEmpty(currentAccount.UserName))
                 {
                     btnUserName.Text = currentAccount.UserName;
                 }
@@ -475,8 +665,10 @@
                 {
                     if (doorLock.IsFreezeAccount[currentAccount.SubAccountDistributedMark] == true)
                     {
-
-                        new Tip() { MaxWidth = 150, Text = btnUserName.Text + Language.StringByID(R.MyInternationalizationString.AccountIsFreezed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(this.btnTip);
+                        Application.RunOnMainThread(() =>
+                        {
+                            new Tip() { MaxWidth = 150, Text = btnUserName.Text + Language.StringByID(R.MyInternationalizationString.AccountIsFreezed), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance);
+                        });
                         return;
                     }
 
@@ -513,401 +705,159 @@
                 bottomFrameLayout.RemoveAll();
             };
 
-            btnFinish.MouseUpEventHandler += async (sender, e) =>
-            {
-                if (curAccountId == "")
-                {
-                    flMain.RemoveFromParent();
-                    bottomFrameLayout.RemoveAll();
-                }
-                else
-                {
-                    var addLockInfo = new ZigBee.Device.DoorLock.AddDoorLockData();
-                    if (UserCenterResourse.UserInfo.AuthorityNo != 1)
-                    {
-                        addLockInfo.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
-                        addLockInfo.IsOtherAccountCtrl = true;
-                    }
-                    addLockInfo.CloudAccountId = curAccountId;
-                    if (doorLock.DeviceAddr != null)
-                    {
-                        addLockInfo.DoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint;
-                    }
-                    addLockInfo.OpenLockMode = curDoorLockUser.UnlockType;
-                    addLockInfo.DoorLockLocalUserId = curDoorLockUser.UserID.ToString();
+            btnFinish.MouseUpEventHandler += (sender, e) =>
+           {
+               System.Threading.Tasks.Task.Run(async () =>
+               {
+                   try
+                   {
+                       Application.RunOnMainThread(() =>
+                       {
+                           CommonPage.Loading.Start("");
+                       });
+                       if (curAccountId == "")
+                       {
+                           Application.RunOnMainThread(() =>
+                           {
+                               flMain.RemoveFromParent();
+                               bottomFrameLayout.RemoveAll();
+                               CommonPage.Loading.Hide();
+                           });
+                       }
+                       else
+                       {
+                           var addLockInfo = new ZigBee.Device.DoorLock.AddDoorLockData();
+                           if (UserCenterResourse.UserInfo.AuthorityNo != 1)
+                           {
+                               addLockInfo.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
+                               addLockInfo.IsOtherAccountCtrl = true;
+                           }
+                           addLockInfo.CloudAccountId = curAccountId;
+                           if (doorLock.DeviceAddr != null)
+                           {
+                               addLockInfo.DoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint;
+                           }
+                           addLockInfo.OpenLockMode = curDoorLockUser.UnlockType;
+                           addLockInfo.DoorLockLocalUserId = curDoorLockUser.UserID.ToString();
+                           switch (curDoorLockUser.UnlockType)
+                           {
+                               case 0:
+                                   if (!string.IsNullOrEmpty(curDoorLockUser.UserName))
+                                   {
+                                       addLockInfo.UserIdRemarks = curDoorLockUser.UserName;
+                                   }
+                                   else
+                                   {
+                                       addLockInfo.UserIdRemarks = Language.StringByID(R.MyInternationalizationString.Password) + "ID" + curDoorLockUser.UserID;
+                                   }
+                                   break;
+                               case 3:
+                                   if (!string.IsNullOrEmpty(curDoorLockUser.UserName))
+                                   {
+                                       addLockInfo.UserIdRemarks = curDoorLockUser.UserName;
+                                   }
+                                   else
+                                   {
+                                       addLockInfo.UserIdRemarks = Language.StringByID(R.MyInternationalizationString.IcCard) + "ID" + curDoorLockUser.UserID;
+                                   }
+                                   break;
+                               case 13:
+                                   if (!string.IsNullOrEmpty(curDoorLockUser.UserName))
+                                   {
+                                       addLockInfo.UserIdRemarks = curDoorLockUser.UserName;
+                                   }
+                                   else
+                                   {
+                                       addLockInfo.UserIdRemarks = Language.StringByID(R.MyInternationalizationString.CalmFingerprintMark) + "ID" + +curDoorLockUser.UserID;
+                                   }
+                                   break;
+                               case 14:
+                                   if (!string.IsNullOrEmpty(curDoorLockUser.UserName))
+                                   {
+                                       addLockInfo.UserIdRemarks = curDoorLockUser.UserName;
+                                   }
+                                   else
+                                   {
+                                       addLockInfo.UserIdRemarks = Language.StringByID(R.MyInternationalizationString.FaceIDMark) + "ID" + +curDoorLockUser.UserID;
+                                   }
+                                   break;
+                               case 15:
+                                   if (!string.IsNullOrEmpty(curDoorLockUser.UserName))
+                                   {
+                                       addLockInfo.UserIdRemarks = curDoorLockUser.UserName;
+                                   }
+                                   else
+                                   {
+                                       addLockInfo.UserIdRemarks = Language.StringByID(R.MyInternationalizationString.Fingerprint) + "ID" + +curDoorLockUser.UserID;
+                                   }
+                                   break;
+                           }
+                           addLockInfo.EntryTime = curDoorLockUser.EntryTime;
+                           var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/AddDoorLock", addLockInfo);
+                           if (result != null)
+                           {
+                               if (result.StateCode == "Success")
+                               {
+                                   //瀛橀棬閿佷俊鎭�
+                                   var resultList = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetCloudLocalDoorLocklist(doorLock, curAccountId);
+                                   var uList = new List<int> { };
+                                   if (resultList != null)
+                                   {
+                                       foreach (var a in resultList.Keys)
+                                       {
+                                           uList.Add(a);
+                                       }
+                                   }
+                                   var d = uList.Find((value) => { return value == curDoorLockUser.UserID; });
+                                   if (d != null)
+                                   {
+                                       Application.RunOnMainThread(() =>
+                                       {
+                                           new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.DistributeSuccess), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance);
+                                           UndateUnlockMethodAction += (obj) =>
+                                           {
+                                               RefreshList(obj);
+                                           };
+                                           TypeRefresh(doorLock);
+                                           CommonPage.Loading.Hide();
+                                           flMain.RemoveFromParent();
+                                           bottomFrameLayout.RemoveAll();
 
-                    switch (curDoorLockUser.UnlockType)
-                    {
-                        case 0:
-                            if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null)
-                            {
-                                addLockInfo.UserIdRemarks = curDoorLockUser.UserName;
-                            }
-                            else
-                            {
-                                addLockInfo.UserIdRemarks = Language.StringByID(R.MyInternationalizationString.Password) + "ID" + curDoorLockUser.UserID;
-                            }
-                            break;
-                        case 3:
-                            if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null)
-                            {
-                                addLockInfo.UserIdRemarks = curDoorLockUser.UserName;
-                            }
-                            else
-                            {
-                                addLockInfo.UserIdRemarks = Language.StringByID(R.MyInternationalizationString.IcCard) + "ID" + curDoorLockUser.UserID;
-                            }
-                            break;
-                        case 15:
-                            if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null)
-                            {
-                                addLockInfo.UserIdRemarks = curDoorLockUser.UserName;
-                            }
-                            else
-                            {
-                                addLockInfo.UserIdRemarks = Language.StringByID(R.MyInternationalizationString.Fingerprint) + "ID" + +curDoorLockUser.UserID;
-                            }
-                            break;
-                    }
-
-                    addLockInfo.EntryTime = curDoorLockUser.EntryTime;
-                    var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/AddDoorLock", addLockInfo);
-                    if (result != null)
-                    {
-                        if (result.StateCode == "Success")
-                        {
-                            //瀛橀棬閿佷俊鎭�
-                            var resultList = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetCloudLocalDoorLocklist(doorLock, curAccountId);
-                            var uList = new List<int> { };
-                            if (resultList != null)
-                            {
-                                foreach (var a in resultList.Keys)
-                                {
-                                    uList.Add(a);
-                                }
-                            }
-                            var d = uList.Find((value) => { return value == curDoorLockUser.UserID; });
-                            if (d != null)
-                            {
-                                RefreshList();
-                                flMain.RemoveFromParent();
-                                bottomFrameLayout.RemoveAll();
-                            }
-                            else
-                            {
-                                new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.CloudServerResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(this.btnTip);
-                            }
-                        }
-                        else
-                        {
-                            new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFailed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinish);
-                            flMain.RemoveFromParent();
-                            bottomFrameLayout.RemoveAll();
-                        }
-                    }
-                    else
-                    {
-                        new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.CloudServerResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnFinish);
-                        flMain.RemoveFromParent();
-                        bottomFrameLayout.RemoveAll();
-                    }
-                }
-            };
+                                       });
+                                   }
+                                   else
+                                   {
+                                       Application.RunOnMainThread(() =>
+                                       {
+                                           CommonPage.Loading.Hide();
+                                           new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFailed), Direction = AMPopTipDirection.Down, CloseTime = 1 }.Show(Common.CommonPage.Instance);
+                                       });
+                                   }
+                               }
+                               else
+                               {
+                                   Application.RunOnMainThread(() =>
+                                   {
+                                       CommonPage.Loading.Hide();
+                                       new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFailed), Direction = AMPopTipDirection.Down, CloseTime = 1 }.Show(Common.CommonPage.Instance);
+                                   });
+                                   return;
+                               }
+                           }
+                           else
+                           {
+                               Application.RunOnMainThread(() =>
+                               {
+                                   CommonPage.Loading.Hide();
+                                   new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFailed), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(btnFinish);
+                               });
+                               return;
+                           }
+                       }
+                   }
+                   catch { }
+               });
+           };
         }
-
-        // 渚ц竟瀵艰埅鏍�
-        void SideslipFramelayout()
-        {
-            var dialog = new Dialog
-            {
-            };
-            dialog.Show();
-
-            var flMain = new FrameLayout { BackgroundColor = 0x00000000 };
-            dialog.AddChidren(flMain);
-            flMain.MouseUpEventHandler += (sender11, e11) =>
-            {
-                dialog.Close();
-            };
-
-            var sidelipFrameLayout = new FrameLayout()
-            {
-                Height = Application.GetRealHeight(625),
-                Width = Application.GetRealWidth(449),
-                Y = Application.GetRealHeight(115 + 160),
-                X = Application.GetRealWidth(596),
-                BackgroundImagePath = "DoorLock/SideslipPic.png",
-            };
-            flMain.AddChidren(sidelipFrameLayout);
-
-            var sidelipVerticalScrolViewLayout = new VerticalScrolViewLayout()
-            {
-                Height = Application.GetRealHeight(600),
-                Y = Application.GetRealHeight(28),
-            };
-            sidelipFrameLayout.AddChidren(sidelipVerticalScrolViewLayout);
-            Button oldbutton = null;
-            Button oldbuttonText = null;
-            for (var i = 0; i < 4; i++)
-            {
-                var rowFrameLayout = new RowLayout()
-                {
-                    Height = Application.GetRealHeight(150),
-                };
-                sidelipVerticalScrolViewLayout.AddChidren(rowFrameLayout);
-
-                var btnAllMethod = new Button()
-                {
-                    Width = Application.GetRealWidth(81),
-                    Height = Application.GetRealHeight(81),
-                    X = Application.GetRealWidth(81),
-                    Y = Application.GetRealHeight(55),
-                };
-                rowFrameLayout.AddChidren(btnAllMethod);
-
-                var btnMethodText = new Button()
-                {
-                    Width = Application.GetRealWidth(311),
-                    Height = Application.GetRealHeight(58),
-                    X = Application.GetRealWidth(173),
-                    Y = Application.GetRealHeight(69),
-                    TextColor = Shared.Common.ZigbeeColor.Current.XMGray3,
-                    TextSize = 14,
-                    TextAlignment = TextAlignment.CenterLeft,
-                };
-                rowFrameLayout.AddChidren(btnMethodText);
-
-                EventHandler<MouseEventArgs> hander = (sender, e) =>
-                {
-                    if (!btnAllMethod.IsSelected)
-                    {
-                        if (oldbutton != null)
-                        {
-                            oldbutton.IsSelected = false;
-                        }
-                        if (oldbuttonText != null)
-                        {
-                            oldbuttonText.TextColor = Shared.Common.ZigbeeColor.Current.XMGray3;
-                        }
-                        oldbutton = btnAllMethod;
-                        oldbuttonText = btnMethodText;
-                        doorLock.currentUserDisplayMethod = btnMethodText.Text;
-                        btnAllMethod.IsSelected = true;
-                        oldbuttonText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack;
-
-                        // 绫诲瀷鍖哄垎
-                        if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.AllMethod))
-                        {
-                            RefreshList();
-                        }
-                        if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.PasswordUnlock))
-                        {
-                            DisplayByType(0);
-                        }
-                        if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.FingerprintUnlock))
-                        {
-                            DisplayByType(15);
-                        }
-                        if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.ProximithCardUnlock))
-                        {
-                            DisplayByType(3);
-                        }
-                    }
-                    dialog.Close();
-                };
-                rowFrameLayout.MouseUpEventHandler += hander;
-                btnAllMethod.MouseUpEventHandler += hander;
-                btnMethodText.MouseUpEventHandler += hander;
-
-                switch (i)
-                {
-                    case 0:
-                        btnAllMethod.UnSelectedImagePath = "DoorLock/AllMethod.png";
-                        btnAllMethod.SelectedImagePath = "DoorLock/AllMethodOn.png";
-                        btnMethodText.Text = Language.StringByID(R.MyInternationalizationString.AllMethod);
-                        break;
-                    case 1:
-                        btnAllMethod.UnSelectedImagePath = "DoorLock/Password.png";
-                        btnAllMethod.SelectedImagePath = "DoorLock/PasswordOn.png";
-                        btnMethodText.Text = Language.StringByID(R.MyInternationalizationString.PasswordUnlock);
-                        break;
-                    case 2:
-                        btnAllMethod.UnSelectedImagePath = "DoorLock/Fingerprint.png";
-                        btnAllMethod.SelectedImagePath = "DoorLock/FingerprintOn.png";
-                        btnMethodText.Text = Language.StringByID(R.MyInternationalizationString.FingerprintUnlock);
-                        break;
-                    case 3:
-                        btnAllMethod.UnSelectedImagePath = "DoorLock/proximityCard.png";
-                        btnAllMethod.SelectedImagePath = "DoorLock/proximityCardOn.png";
-                        btnMethodText.Text = Language.StringByID(R.MyInternationalizationString.ProximithCardUnlock);
-                        break;
-                }
-
-                if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.AllMethod) && i == 0)
-                {
-                    btnAllMethod.IsSelected = true;
-                    btnMethodText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack;
-                    oldbutton = btnAllMethod;
-                    oldbuttonText = btnMethodText;
-                }
-                if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.PasswordUnlock) && i == 1)
-                {
-                    btnAllMethod.IsSelected = true;
-                    btnMethodText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack;
-                    oldbutton = btnAllMethod;
-                    oldbuttonText = btnMethodText;
-                }
-                if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.FingerprintUnlock) && i == 2)
-                {
-                    btnAllMethod.IsSelected = true;
-                    btnMethodText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack;
-                    oldbutton = btnAllMethod;
-                    oldbuttonText = btnMethodText;
-                }
-                if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.ProximithCardUnlock) && i == 3)
-                {
-                    btnAllMethod.IsSelected = true;
-                    btnMethodText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack;
-                    oldbutton = btnAllMethod;
-                    oldbuttonText = btnMethodText;
-                }
-            }
-        }
-
-        // 閫氳繃绫诲瀷绛涢�夋樉绀�
-        void DisplayByType(int unlockMethod)
-        {
-            bodyView.RemoveAll();
-            foreach (var curUserId in doorLock.localDoorLockUserList.Keys)
-            {
-                var curDoorLockUser = doorLock.localDoorLockUserList[curUserId];
-                if (curDoorLockUser.ConnectedAccount != "" || curDoorLockUser.UnlockType != unlockMethod)
-                {
-                    continue;
-                }
-                var RowView = new FrameLayout()
-                {
-                    Height = Application.GetRealHeight(161),
-                    BackgroundColor = Shared.Common.ZigbeeColor.Current.XMWhite,
-                };
-                bodyView.AddChidren(RowView);
-
-                var btnDistributeUnlockIconFrameLayout = new FrameLayout()
-                {
-                    Height = Application.GetRealHeight(84),
-                    Width = Application.GetRealWidth(84),
-                    X = Application.GetRealWidth(58),
-                    Y = Application.GetRealHeight(43),
-                };
-                RowView.AddChidren(btnDistributeUnlockIconFrameLayout);
-
-                var btnDistributeUnlockIcon = new Button()
-                {
-                    Height = Application.GetRealHeight(84),
-                    Width = Application.GetRealWidth(84),
-                    UnSelectedImagePath = "DoorLock/DistributeUnlockIcon.png",
-                };
-                btnDistributeUnlockIconFrameLayout.AddChidren(btnDistributeUnlockIcon);
-
-                var btnText = new Button()
-                {
-                    X = Application.GetRealWidth(176),
-                    Width = Application.GetRealWidth(300),
-                    Height = Application.GetRealHeight(300),
-                    TextAlignment = TextAlignment.CenterLeft,
-                    TextColor = Shared.Common.ZigbeeColor.Current.XMBlack,
-                    Gravity = Gravity.CenterVertical,
-                };
-                RowView.AddChidren(btnText);
-
-                var line2 = new Button()
-                {
-                    Y = RowView.Height - 1,
-                    X = Application.GetRealWidth(58),
-                    Width = Application.GetRealWidth(965),
-                    Height = 1,
-                    BackgroundColor = Shared.Common.ZigbeeColor.Current.XMRowLine,
-                };
-                RowView.AddChidren(line2);
-
-                #region 鏁版嵁澶勭悊
-                switch (curDoorLockUser.UnlockType)
-                {
-                    case 0:
-                        if (curDoorLockUser.UserName != "")
-                        {
-                            btnText.Text = curDoorLockUser.UserName;
-                        }
-                        else
-                        {
-                            btnText.Text = Language.StringByID(R.MyInternationalizationString.Password) + "ID" + curDoorLockUser.UserID;
-                        }
-                        break;
-                    case 3:
-                        if (curDoorLockUser.UserName != "")
-                        {
-                            btnText.Text = curDoorLockUser.UserName;
-                        }
-                        else
-                        {
-                            btnText.Text = Language.StringByID(R.MyInternationalizationString.IcCard) + "ID" + curDoorLockUser.UserID;
-                        }
-                        break;
-                    case 15:
-                        if (curDoorLockUser.UserName != "")
-                        {
-                            btnText.Text = curDoorLockUser.UserName;
-                        }
-                        else
-                        {
-                            btnText.Text = Language.StringByID(R.MyInternationalizationString.Fingerprint) + "ID" + +curDoorLockUser.UserID;
-                        }
-                        break;
-                }
-
-                EventHandler<MouseEventArgs> eHandler = (sender, e) =>
-                {
-                    MatchUsersFrameLayout(curDoorLockUser);
-                };
-                btnDistributeUnlockIcon.MouseUpEventHandler += eHandler;
-                btnDistributeUnlockIconFrameLayout.MouseUpEventHandler += eHandler;
-                RowView.MouseUpEventHandler += eHandler;
-                btnText.MouseUpEventHandler += eHandler;
-                #endregion
-            }
-        }
-        #region 鈼� 鎺ュ彛瀹炵幇__________________________
-        /// <summary>
-        /// 澶勭悊鍙樺寲浜嬩欢 --灏嗗純鐢� 鏀圭敤DeviceInfoChange()
-        /// </summary>
-        /// <returns>The changed.</returns>
-        /// <param name="common">Common.</param>
-        public void Changed(CommonDevice common)
-        {
-
-        }
-        /// <summary>
-        /// 澶勭悊鍙樺寲浜嬩欢
-        /// </summary>
-        /// <param name="common"></param>
-        /// <param name="typeTag"></param>
-        public void DeviceInfoChange(CommonDevice common, string typeTag)
-        {
-        }
-        /// <summary>
-        /// Changeds the IL ogic status.
-        /// </summary>
-        /// <param name="logic">Logic.</param>
-        public void ChangedILogicStatus(ZigBee.Device.Logic logic)
-        {
-        }
-        /// <summary>
-        /// Changeds the IS cene status.
-        /// </summary>
-        /// <param name="scene">Scene.</param>
-        public void ChangedISceneStatus(Scene scene)
-        {
-        }
-        #endregion
     }
 }

--
Gitblit v1.8.0