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/UnLockMethod.cs |  348 +++++++++++++++++++++------------------------------------
 1 files changed, 127 insertions(+), 221 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UnLockMethod.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UnLockMethod.cs
index 0f80521..158d0a8 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UnLockMethod.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UnLockMethod.cs
@@ -25,10 +25,6 @@
                         var doorLock = tempDevice as ZigBee.Device.DoorLock;
                         if (doorLock.doorLockProgrammingEventNotificationCommand != null)
                         {
-
-                            Application.RunOnMainThread(() =>
-                            {
-                            });
                         }
                     }
                 }
@@ -44,16 +40,43 @@
             BackgroundColor = Shared.Common.ZigbeeColor.Current.GXCTopViewBackgroundColor;
         }
 
-        #region 鈼� 鍙橀噺鐢虫槑__________________________
-        ZigBee.Device.DoorLock doorLock;//褰撳墠闂ㄩ攣
-        VerticalListRefreshControl bodyView;//鍒锋柊View
-        Button currentMethod;// 褰撳墠閫夋嫨鐨勬柟寮�
-        Shared.Phone.UserCenter.MemberInfoRes curAccountObj;//褰撳墠璐︽埛
+        #region 鍙橀噺鐢虫槑
+        /// <summary>
+        /// 褰撳墠闂ㄩ攣
+        /// </summary>
+        ZigBee.Device.DoorLock doorLock;
+        /// <summary>
+        /// 鍒锋柊View
+        /// </summary>
+        VerticalListRefreshControl bodyView;
+        /// <summary>
+        /// 褰撳墠閫夋嫨鐨勬柟寮�
+        /// </summary>
+        Button currentMethod;
+        /// <summary>
+        /// 褰撳墠璐︽埛
+        /// </summary>
+        Shared.Phone.UserCenter.MemberInfoRes curAccountObj;
+        /// <summary>
+        /// 鏁版嵁涓虹┖锛孶I鏄剧ず鐨勭┖鍥剧墖
+        /// </summary>
         Button entryStatusPic;
+        /// <summary>
+        /// 鏁版嵁涓虹┖锛孶I鏄剧ず鐨勬枃鏈彁绀�
+        /// </summary>
         Button btnPicTip;
+        /// <summary>
+        /// 鏁版嵁涓虹┖锛孶I鏄剧ず鐨勬枃鏈彁绀�
+        /// </summary>
         Button btnPicTip1;
-        bool isSecondDel;//鏄惁浜屾鍒犻櫎
-        FrameLayout blankFrameLayout;//绌烘暟鎹樉绀哄竷灞�
+        /// <summary>
+        /// //鏄惁浜屾鍒犻櫎
+        /// </summary>
+        bool isSecondDel;
+        /// <summary>
+        /// 绌烘暟鎹樉绀哄竷灞�
+        /// </summary>
+        FrameLayout blankFrameLayout;
         #endregion
 
         /// <summary>
@@ -80,8 +103,12 @@
                 {
                     Application.RunOnMainThread(() =>
                     {
-                        // 绫诲瀷鍖哄垎 
-                        TypeRefresh();
+                        // 绫诲瀷鍖哄垎
+                        UndateUnlockMethodAction += (obj) =>
+                        {
+                            RefreshList(obj);
+                        };
+                        TypeRefresh(doorLock);
                         CommonPage.Loading.Hide();
                         bodyView.EndHeaderRefreshing();
                     });
@@ -89,11 +116,12 @@
             });
         }
 
-        /// <summary>
-        /// UI鏄剧ず 
+        /// <summary>
+        /// UI鏄剧ず 
         /// </summary>
         public void Show()
         {
+            UserView.HomePage.Instance.ScrollEnabled = false;
             doorLock.currentUserDisplayMethod = "";
             this.TopFrameLayout(this, Language.StringByID(R.MyInternationalizationString.LockMethod));
             this.btnTitleLine.Visible = false;
@@ -158,7 +186,10 @@
                 RefreshList();
             }
         }
-        //涓儴甯冨眬
+
+        /// <summary>
+        /// 涓儴甯冨眬
+        /// </summary>
         void MidFrameLayoutContent()
         {
             #region 寮�閿佹柟寮廢I
@@ -198,6 +229,14 @@
             {
                 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);
@@ -214,10 +253,16 @@
             };
             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
             {
                 Y = midTopFrameLayout.Bottom,
@@ -259,6 +304,7 @@
                 Width = Application.GetRealHeight(757),
                 Visible = false,
                 UnSelectedImagePath = "DoorLock/UnLockBlankPic.png",
+                Gravity = Gravity.CenterHorizontal,
             };
             blankFrameLayout.AddChidren(entryStatusPic);
 
@@ -285,6 +331,10 @@
                 TextSize = 12,
             };
             blankFrameLayout.AddChidren(btnPicTip1);
+            if (UserCenterResourse.UserInfo.AuthorityNo != 1)
+            {
+                btnPicTip1.Width = 0;
+            }
         }
 
         /// <summary>
@@ -302,7 +352,7 @@
             {
                 var curDoorLockUser = doorLock.localDoorLockUserList[curUserId];
 
-                if (curDoorLockUser.ConnectedAccount == "" || curDoorLockUser.ConnectedAccount != curAccountObj.SubAccountDistributedMark)
+                if (string.IsNullOrEmpty(curDoorLockUser.ConnectedAccount) || curDoorLockUser.ConnectedAccount != curAccountObj.SubAccountDistributedMark)
                 {
                     continue;
                 }
@@ -354,6 +404,18 @@
                                 continue;
                             }
                             break;
+                        case 13:
+                            if (curDoorLockUser.UnlockType != unlockMethod)
+                            {
+                                continue;
+                            }
+                            break;
+                        case 14:
+                            if (curDoorLockUser.UnlockType != unlockMethod)
+                            {
+                                continue;
+                            }
+                            break;
                         case 15:
                             if (curDoorLockUser.UnlockType != unlockMethod)
                             {
@@ -364,8 +426,7 @@
                             break;
                     }
 
-                    #region UI
-
+                    #region UI 
                     var rowFrameLayout = new RowLayoutControl(bodyView.rowSpace / 2);
                     rowFrameLayout.BackgroundColor = ZigbeeColor.Current.XMWhite;
                     bodyView.AddChidren(rowFrameLayout);
@@ -374,7 +435,7 @@
                     btnicon.UnSelectedImagePath = "DoorLock/DoorLockUserPic.png";
                     //涓婇潰闂ㄩ攣鐢ㄦ埛鍚嶇О涓�琛� 
                     var memberText = "";
-                    if (curAccountObj.UserName == "" || curAccountObj.UserName == null)
+                    if (string.IsNullOrEmpty(curAccountObj.UserName))
                     {
                         memberText = curAccountObj.Account;
                     }
@@ -441,13 +502,17 @@
                                                      localDoorLockObj.UserID = curDoorLockUser.UserID;
                                                      doorLock.localDoorLockUserList.Remove(curUserId);
                                                      doorLock.ReSave();
-                                                     TypeRefresh();
+                                                     UndateUnlockMethodAction += (obj) =>
+                                                     {
+                                                         RefreshList(obj);
+                                                     };
+                                                     TypeRefresh(doorLock);
                                                  }
                                              }
                                              else
                                              {
-                                                //寮�鍏冲浘鏍�
-                                                new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.RemoveFailed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser);
+                                                 //寮�鍏冲浘鏍�
+                                                 new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.RemoveFailed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser);
                                              }
                                          }
                                          else
@@ -485,7 +550,11 @@
                                                          var localDoorLockObj = new ZigBee.Device.DoorLock.LocaDoorLockObj() { };
                                                          localDoorLockObj.UserID = curDoorLockUser.UserID;
                                                          doorLock.localDoorLockUserList.Remove(curUserId);
-                                                         TypeRefresh();
+                                                         UndateUnlockMethodAction += (obj) =>
+                                                         {
+                                                             RefreshList(obj);
+                                                         };
+                                                         TypeRefresh(doorLock);
                                                      }
                                                  }
                                                  else
@@ -522,7 +591,7 @@
                              {
                                  CommonPage.Loading.Hide();
                              }
-                         }; 
+                         };
                     };
                     #endregion
 
@@ -536,7 +605,7 @@
                     switch (curDoorLockUser.UnlockType)
                     {
                         case 0:
-                            if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null)
+                            if (!string.IsNullOrEmpty(curDoorLockUser.UserName))
                             {
                                 btnDoorlockUser.Text = curDoorLockUser.UserName;
                             }
@@ -546,7 +615,7 @@
                             }
                             break;
                         case 3:
-                            if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null)
+                            if (!string.IsNullOrEmpty(curDoorLockUser.UserName))
                             {
                                 btnDoorlockUser.Text = curDoorLockUser.UserName;
                             }
@@ -555,8 +624,28 @@
                                 btnDoorlockUser.Text = Language.StringByID(R.MyInternationalizationString.IcCard) + "ID" + curDoorLockUser.UserID;
                             }
                             break;
+                        case 13:
+                            if (!string.IsNullOrEmpty(curDoorLockUser.UserName))
+                            {
+                                btnDoorlockUser.Text = curDoorLockUser.UserName;
+                            }
+                            else
+                            {
+                                btnDoorlockUser.Text = Language.StringByID(R.MyInternationalizationString.CalmFingerprintMark) + "ID" + +curDoorLockUser.UserID;
+                            }
+                            break;
+                        case 14:
+                            if (!string.IsNullOrEmpty(curDoorLockUser.UserName))
+                            {
+                                btnDoorlockUser.Text = curDoorLockUser.UserName;
+                            }
+                            else
+                            {
+                                btnDoorlockUser.Text = Language.StringByID(R.MyInternationalizationString.FaceIDMark) + "ID" + +curDoorLockUser.UserID;
+                            }
+                            break;
                         case 15:
-                            if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null)
+                            if (!string.IsNullOrEmpty(curDoorLockUser.UserName))
                             {
                                 btnDoorlockUser.Text = curDoorLockUser.UserName;
                             }
@@ -595,11 +684,16 @@
                                      var localDoorLockObj = new ZigBee.Device.DoorLock.LocaDoorLockObj() { };
                                      localDoorLockObj.UserID = curDoorLockUser.UserID;
                                      localDoorLockObj.UnlockType = curDoorLockUser.UnlockType;
+                                     localDoorLockObj.PrimaryId = curDoorLockUser.PrimaryId;
                                      localDoorLockObj.EntryTime = curDoorLockUser.EntryTime;
                                      localDoorLockObj.UserName = refreshDoorLockData.UserIdRemarks;
                                      localDoorLockObj.ConnectedAccount = curAccountObj.SubAccountDistributedMark;
                                      doorLock.localDoorLockUserList.Add(curDoorLockUser.UserID, localDoorLockObj);
-                                     TypeRefresh();
+                                     UndateUnlockMethodAction += (obj1) =>
+                                     {
+                                         RefreshList(obj1);
+                                     };
+                                     TypeRefresh(doorLock);
                                  }
                              }
                              else
@@ -612,188 +706,10 @@
                              new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.CloudServerResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser);
                          }
                      };
-                    btnDoorlockUser.EditorEnterAction += action; 
+                    btnDoorlockUser.EditorEnterAction += action;
                     #endregion
                     i++;
-                } 
-            }
-        }
-
-        // 渚ц竟瀵艰埅鏍�
-        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),
-                    LineColor = Shared.Common.ZigbeeColor.Current.XMRowLine,
-                    X = Application.GetRealWidth(81),
-                };
-                sidelipVerticalScrolViewLayout.AddChidren(rowFrameLayout);
-
-                var btnAllMethod = new Button()
-                {
-                    Width = Application.GetRealWidth(81),
-                    Height = Application.GetRealHeight(81),
-                    Y = Application.GetRealHeight(35),
-                };
-                rowFrameLayout.AddChidren(btnAllMethod);
-
-                var btnMethodText = new Button()
-                {
-                    Width = Application.GetRealWidth(311),
-                    Height = Application.GetRealHeight(58),
-                    X = Application.GetRealWidth(92),
-                    Y = Application.GetRealHeight(49),
-                    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;
-                        doorLock.ReSave();
-                        btnAllMethod.IsSelected = true;
-                        oldbuttonText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack;
-                        oldbuttonText.IsBold = true;
-                        TypeRefresh();
-                    }
-                    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 == "" && i == 0)
-                {
-                    btnAllMethod.IsSelected = true;
-                    btnMethodText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack;
-                    btnMethodText.IsBold = true;
-                    oldbutton = btnAllMethod;
-                    oldbuttonText = btnMethodText;
-                }
-                if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.AllMethod) && i == 0)
-                {
-                    btnAllMethod.IsSelected = true;
-                    btnMethodText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack;
-                    btnMethodText.IsBold = true;
-                    oldbutton = btnAllMethod;
-                    oldbuttonText = btnMethodText;
-                }
-                if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.PasswordUnlock) && i == 1)
-                {
-                    btnAllMethod.IsSelected = true;
-                    btnMethodText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack;
-                    btnMethodText.IsBold = true;
-                    oldbutton = btnAllMethod;
-                    oldbuttonText = btnMethodText;
-                }
-                if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.FingerprintUnlock) && i == 2)
-                {
-                    btnAllMethod.IsSelected = true;
-                    btnMethodText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack;
-                    btnMethodText.IsBold = true;
-                    oldbutton = btnAllMethod;
-                    oldbuttonText = btnMethodText;
-                }
-                if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.ProximithCardUnlock) && i == 3)
-                {
-                    btnAllMethod.IsSelected = true;
-                    btnMethodText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack;
-                    btnMethodText.IsBold = true;
-                    oldbutton = btnAllMethod;
-                    oldbuttonText = btnMethodText;
-                }
-            }
-        }
-
-        //绫诲瀷鍖哄垎 
-        void TypeRefresh()
-        {
-            if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.PasswordUnlock))
-            {
-                RefreshList(0);
-            }
-            else if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.FingerprintUnlock))
-            {
-                RefreshList(15);
-            }
-            else if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.ProximithCardUnlock))
-            {
-                RefreshList(3);
-            }
-            else
-            {
-                RefreshList();
             }
         }
 
@@ -802,19 +718,9 @@
         /// </summary>
         public override void RemoveFromParent()
         {
+            UserView.HomePage.Instance.ScrollEnabled = true;
             ZbGateway.StatusList.Remove(this);
             base.RemoveFromParent();
-        }
-
-        public void Changed(CommonDevice common)
-        {
-        }
-        public void ChangedILogicStatus(ZigBee.Device.Logic logic)
-        {
-        }
-
-        public void ChangedISceneStatus(Scene scene)
-        {
         }
     }
 }

--
Gitblit v1.8.0