From 9f326f4000847e6167d8166fa2f6a66f53cb3734 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期四, 17 十二月 2020 09:07:13 +0800
Subject: [PATCH] 新云端Ver1.3

---
 ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UndistributeDoorlockUserPage.cs |  189 ++++++++++++++++++----------------------------
 1 files changed, 75 insertions(+), 114 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UndistributeDoorlockUserPage.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UndistributeDoorlockUserPage.cs
index 0fda080..cbe5d50 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UndistributeDoorlockUserPage.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UndistributeDoorlockUserPage.cs
@@ -4,28 +4,49 @@
 using ZigBee.Device;
 namespace Shared.Phone.UserCenter.DoorLock
 {
-    public class UndistributeDoorlockUserPage : DoorLockCommonLayout, ZigBee.Common.IStatus
+    public class UndistributeDoorlockUserPage : DoorLockCommonLayout
     {
         /// <summary>
         /// 鏋勯�犲嚱鏁�
         /// </summary>
         /// <param name="doorLock"></param>
-        public UndistributeDoorlockUserPage(ZigBee.Device.DoorLock doorLock, List<Shared.Phone.UserCenter.MemberInfoRes> localAccountList)
+        public UndistributeDoorlockUserPage(ZigBee.Device.DoorLock doorLock, List<MemberInfoRes> localAccountList)
         {
             this.doorLock = doorLock;
             this.localAccountList = localAccountList;
             BackgroundColor = Shared.Common.ZigbeeColor.Current.GXCTopViewBackgroundColor;
         }
 
-        #region 鈼� 鍙橀噺鐢虫槑__________________________
+        #region 鍙橀噺鐢虫槑 
+        /// <summary>
+        /// 褰撳墠闂ㄩ攣
+        /// </summary>
         ZigBee.Device.DoorLock doorLock;
+        /// <summary>
+        /// 搴曢儴鐧借壊甯冨眬
+        /// </summary>
         FrameLayout bottomFrameLayout;
+        /// <summary>
+        /// 褰撳墠绫诲瀷
+        /// </summary>
         string currentType = string.Empty;
-        List<Shared.Phone.UserCenter.MemberInfoRes> localAccountList;
+        /// <summary>
+        /// 鏈湴璐︽埛鍒楄〃
+        /// </summary>
+        List<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(() =>
@@ -57,8 +79,8 @@
             });
         }
 
-        /// <summary>
-        /// UI鏄剧ず
+        /// <summary>
+        /// UI鏄剧ず
         /// </summary>
         public void Show()
         {
@@ -84,6 +106,9 @@
             }
         }
 
+        /// <summary>
+        /// 涓儴甯冨眬
+        /// </summary>
         public void MidFrameLayoutContent()
         {
             var midTopFrameLayout = new FrameLayout()
@@ -164,6 +189,9 @@
             };
         }
 
+        /// <summary>
+        /// 鍒锋柊鍒楄〃
+        /// </summary>
         void RefreshList(int unlockMethod = -1)
         {
             this.midFrameLayout.RemoveAll();
@@ -312,7 +340,9 @@
             }
         }
 
-        //鏈湴璐︽埛
+        /// <summary>
+        /// 鍒嗛厤鏈湴璐︽埛
+        /// </summary> 
         void MatchUsersFrameLayout(ZigBee.Device.DoorLock.LocaDoorLockObj curDoorLockUser)
         {
             #region  UI
@@ -371,7 +401,7 @@
                 Y = Application.GetRealHeight(35),
                 Height = Application.GetRealHeight(63),
                 Width = Application.GetRealWidth(762),
-                Text = Language.StringByID(R.MyInternationalizationString.MatchPerson),
+                Text = Language.StringByID(R.MyInternationalizationString.MatchUser),
                 TextColor = Shared.Common.ZigbeeColor.Current.XMBlack,
                 TextSize = 16,
                 TextAlignment = TextAlignment.Center,
@@ -432,8 +462,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",
@@ -458,25 +488,19 @@
                     btnLine.Visible = false;
                 }
 
-                if (!string.IsNullOrEmpty(currentAccount.UserName))
-                {
-                    btnUserName.Text = currentAccount.UserName;
-                }
-                else
-                {
-                    btnUserName.Text = currentAccount.Account;
-                }
+                btnUserName.Text = currentAccount.ShowName;
 
                 EventHandler<MouseEventArgs> eHandler = (sender, e) =>
                 {
-                    if (doorLock.IsFreezeAccount[currentAccount.SubAccountDistributedMark] == true)
-                    {
-                        Application.RunOnMainThread(() =>
-                        {
-                            new Tip() { MaxWidth = 150, Text = btnUserName.Text + Language.StringByID(R.MyInternationalizationString.AccountIsFreezed), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance);
-                        });
-                        return;
-                    }
+                    //鈽嗐優銉笺偗鈽�
+                    //if (doorLock.IsFreezeAccount[currentAccount.SubAccountDistributedMark] == true)
+                    //{
+                    //    Application.RunOnMainThread(() =>
+                    //    {
+                    //        new Tip() { MaxWidth = 150, Text = btnUserName.Text + Language.StringByID(R.MyInternationalizationString.AccountIsFreezed), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance);
+                    //    });
+                    //    return;
+                    //}
 
                     if (!btnChoose.IsSelected)
                     {
@@ -496,7 +520,8 @@
                         oldbuttonChoose.IsSelected = true;
                         oldbuttonChoose.Visible = true;
                         oldUserName.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack;
-                        curAccountId = currentAccount.SubAccountDistributedMark;
+                        //鈽嗐優銉笺偗鈽�
+                        //curAccountId = currentAccount.SubAccountDistributedMark;
                     }
                 };
                 btnChoose.MouseUpEventHandler += eHandler;
@@ -533,9 +558,10 @@
                        else
                        {
                            var addLockInfo = new ZigBee.Device.DoorLock.AddDoorLockData();
-                           if (UserCenterResourse.UserInfo.AuthorityNo != 1)
+                           if (HdlUserCenterResourse.ResidenceOption.AuthorityNo != 1)
                            {
-                               addLockInfo.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
+                               //鈽嗐優銉笺偗鈽�
+                               //addLockInfo.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
                                addLockInfo.IsOtherAccountCtrl = true;
                            }
                            addLockInfo.CloudAccountId = curAccountId;
@@ -582,7 +608,7 @@
                            var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/AddDoorLock", addLockInfo);
                            if (result != null)
                            {
-                               if (result.StateCode == "Success")
+                               if (result.Code == HttpMessageEnum.A鎴愬姛)
                                {
                                    //瀛橀棬閿佷俊鎭�
                                    var resultList = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetCloudLocalDoorLocklist(doorLock, curAccountId);
@@ -641,9 +667,12 @@
            };
         }
 
-        // 渚ц竟瀵艰埅鏍�
+        /// <summary>
+        /// 渚ц竟瀵艰埅鏍忔悳绱�
+        /// </summary> 
         void SideslipFramelayout()
         {
+            #region sidelipFrameLayout UI
             var dialog = new Dialog
             {
             };
@@ -672,10 +701,13 @@
                 Y = Application.GetRealHeight(28),
             };
             sidelipFrameLayout.AddChidren(sidelipVerticalScrolViewLayout);
+            #endregion
+
             Button oldbutton = null;
             Button oldbuttonText = null;
             for (var i = 0; i < 4; i++)
             {
+                #region rowFrameLayout UI
                 var rowFrameLayout = new RowLayout()
                 {
                     Height = Application.GetRealHeight(150),
@@ -703,7 +735,9 @@
                     TextAlignment = TextAlignment.CenterLeft,
                 };
                 rowFrameLayout.AddChidren(btnMethodText);
+                #endregion
 
+                #region 鏁版嵁澶勭悊
                 EventHandler<MouseEventArgs> hander = (sender, e) =>
                 {
                     if (!btnAllMethod.IsSelected)
@@ -729,75 +763,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,38 +811,5 @@
                 RefreshList();
             }
         }
-        #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