From f17bb6c60db1f24ce05df96aa27d4680e2df0ce6 Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期三, 15 一月 2020 17:16:13 +0800
Subject: [PATCH] 请合并最新代码,(优化代码格式,完成开会后的细节测试)

---
 ZigbeeApp20190114/Shared/Phone/UserCenter/DoorLock/UndistributeDoorlockUserPage.cs |  208 +++++++++++++++++++++++++--------------------------
 1 files changed, 103 insertions(+), 105 deletions(-)

diff --git a/ZigbeeApp20190114/Shared/Phone/UserCenter/DoorLock/UndistributeDoorlockUserPage.cs b/ZigbeeApp20190114/Shared/Phone/UserCenter/DoorLock/UndistributeDoorlockUserPage.cs
index 0fda080..d31a7a1 100644
--- a/ZigbeeApp20190114/Shared/Phone/UserCenter/DoorLock/UndistributeDoorlockUserPage.cs
+++ b/ZigbeeApp20190114/Shared/Phone/UserCenter/DoorLock/UndistributeDoorlockUserPage.cs
@@ -17,15 +17,36 @@
             BackgroundColor = Shared.Common.ZigbeeColor.Current.GXCTopViewBackgroundColor;
         }
 
-        #region 鈼� 鍙橀噺鐢虫槑__________________________
-        ZigBee.Device.DoorLock doorLock;
-        FrameLayout bottomFrameLayout;
-        string currentType = string.Empty;
-        List<Shared.Phone.UserCenter.MemberInfoRes> localAccountList;
-        VerticalRefreshLayout bodyView;
-        Dictionary<int, DoorLockCommonInfo.LocaDoorLockObj> oldLocalDoorLockUserList = new Dictionary<int, DoorLockCommonInfo.LocaDoorLockObj>();
+        #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;
+        /// <summary>
+        /// 婊戝姩甯冨眬View
+        /// </summary>
+        VerticalRefreshLayout bodyView;
+        /// <summary>
+        /// 淇濆瓨涔嬪墠鎼滅储鍒版湰鍦伴棬閿佺敤鎴峰垪琛�
+        /// </summary>
+        Dictionary<int, DoorLockCommonInfo.LocaDoorLockObj> oldLocalDoorLockUserList = new Dictionary<int, DoorLockCommonInfo.LocaDoorLockObj>();
         #endregion
-
+
+        /// <summary>
+        /// 鑾峰彇鎵�鏈夎处鎴风殑闂ㄩ攣鐢ㄦ埛鍒楄〃
+        /// </summary>
         void ReadDoorLockUserInfo()
         {
             System.Threading.Tasks.Task.Run(async () =>
@@ -35,6 +56,7 @@
                     var list = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetDoorLockAllAcountUserlist(doorLock);
                     if (oldLocalDoorLockUserList.Count != 0)
                     {
+                        //濡傛灉鏈娌℃湁鎼滅储鍒帮紝鎻愮ず缃戝叧娌℃湁鍥炲
                         if (list.Count == 0)
                         {
                             Application.RunOnMainThread(() =>
@@ -82,8 +104,11 @@
             {
                 RefreshList();
             }
-        }
-
+        }
+
+        /// <summary>
+        /// 涓儴甯冨眬
+        /// </summary>
         public void MidFrameLayoutContent()
         {
             var midTopFrameLayout = new FrameLayout()
@@ -162,8 +187,11 @@
                 bodyView.BeginHeaderRefreshing();
                 ReadDoorLockUserInfo();
             };
-        }
-
+        }
+
+        /// <summary>
+        /// 鍒锋柊鍒楄〃
+        /// </summary>
         void RefreshList(int unlockMethod = -1)
         {
             this.midFrameLayout.RemoveAll();
@@ -310,9 +338,11 @@
                 #endregion
                 i++;
             }
-        }
-
-        //鏈湴璐︽埛
+        }
+
+        /// <summary>
+        /// 鍒嗛厤鏈湴璐︽埛
+        /// </summary> 
         void MatchUsersFrameLayout(ZigBee.Device.DoorLock.LocaDoorLockObj curDoorLockUser)
         {
             #region  UI
@@ -639,11 +669,14 @@
                    catch { }
                });
            };
-        }
-
-        // 渚ц竟瀵艰埅鏍�
+        }
+
+        /// <summary>
+        /// 渚ц竟瀵艰埅鏍忔悳绱�
+        /// </summary> 
         void SideslipFramelayout()
-        {
+        {
+            #region sidelipFrameLayout UI
             var dialog = new Dialog
             {
             };
@@ -654,8 +687,8 @@
             flMain.MouseUpEventHandler += (sender11, e11) =>
             {
                 dialog.Close();
-            };
-
+            };
+
             var sidelipFrameLayout = new FrameLayout()
             {
                 Height = Application.GetRealHeight(625),
@@ -671,39 +704,44 @@
                 Height = Application.GetRealHeight(600),
                 Y = Application.GetRealHeight(28),
             };
-            sidelipFrameLayout.AddChidren(sidelipVerticalScrolViewLayout);
+            sidelipFrameLayout.AddChidren(sidelipVerticalScrolViewLayout);
+            #endregion
+
             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,
-                };
+                #region rowFrameLayout UI
+                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);
+                #endregion
 
+                #region 鏁版嵁澶勭悊
                 EventHandler<MouseEventArgs> hander = (sender, e) =>
                 {
                     if (!btnAllMethod.IsSelected)
@@ -729,75 +767,35 @@
                 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;
-                }
-
+                DisplayAllUnlockMethod(i, btnAllMethod, btnMethodText);
+
                 if (string.IsNullOrEmpty(doorLock.currentUserDisplayMethod) && i == 0)
-                {
-                    btnAllMethod.IsSelected = true;
-                    btnMethodText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack;
-                    btnMethodText.IsBold = true;
-                    oldbutton = btnAllMethod;
-                    oldbuttonText = btnMethodText;
+                {
+                    CurrentSelectUnlockMethod(btnAllMethod, btnMethodText, oldbutton, oldbuttonText);
                 }
                 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;
+                    CurrentSelectUnlockMethod(btnAllMethod, btnMethodText, oldbutton, oldbuttonText);
                 }
                 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;
+                {
+                    CurrentSelectUnlockMethod(btnAllMethod, btnMethodText, oldbutton, oldbuttonText);
                 }
                 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;
+                    CurrentSelectUnlockMethod(btnAllMethod, btnMethodText, oldbutton, oldbuttonText);
                 }
                 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;
+                {
+                    CurrentSelectUnlockMethod(btnAllMethod, btnMethodText, oldbutton, oldbuttonText);
                 }
+                #endregion
             }
-        }
-
-        //绫诲瀷鍖哄垎 
+        }
+
+        /// <summary>
+        /// 绫诲瀷鍖哄垎 
+        /// </summary>
         void TypeRefresh()
         {
             if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.PasswordUnlock))
@@ -817,7 +815,7 @@
                 RefreshList();
             }
         }
-        #region 鈼� 鎺ュ彛瀹炵幇__________________________
+        #region 鎺ュ彛瀹炵幇
         /// <summary>
         /// 澶勭悊鍙樺寲浜嬩欢 --灏嗗純鐢� 鏀圭敤DeviceInfoChange()
         /// </summary>

--
Gitblit v1.8.0