From 00ab3ddb140ba8bb88b5cf572b004a85e1da85e9 Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期四, 02 一月 2020 19:51:56 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev-tzy' into DEV_GXC

---
 ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UndistributeDoorlockUserPage.cs |  289 +++++++++++++++++++++++++++++++++------------------------
 1 files changed, 165 insertions(+), 124 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UndistributeDoorlockUserPage.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UndistributeDoorlockUserPage.cs
index a0f8318..2858bfa 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UndistributeDoorlockUserPage.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UndistributeDoorlockUserPage.cs
@@ -51,6 +51,7 @@
                     {
                         TypeRefresh();
                         CommonPage.Loading.Hide();
+                        bodyView.EndHeaderRefreshing();
                     });
                 }
             });
@@ -99,8 +100,9 @@
                 Y = Application.GetRealHeight(35),
                 X = Application.GetRealWidth(812 - 100),
                 TextAlignment = TextAlignment.CenterRight,
-                TextColor = Shared.Common.ZigbeeColor.Current.XMTopTitleText,
+                TextColor = Shared.Common.ZigbeeColor.Current.XMBlack,
                 TextSize = 12,
+                IsBold =true,
             };
             midTopFrameLayout.AddChidren(btnAllMethod);
             // 绫诲瀷鍖哄垎 
@@ -158,7 +160,6 @@
             {
                 bodyView.BeginHeaderRefreshing();
                 ReadDoorLockUserInfo();
-                bodyView.EndHeaderRefreshing();
             };
         }
 
@@ -243,14 +244,15 @@
                     TextAlignment = TextAlignment.CenterLeft,
                     TextColor = Shared.Common.ZigbeeColor.Current.XMBlack,
                     Gravity = Gravity.CenterVertical,
+                    TextSize =15,
                 };
                 rowFrameLayout.AddChidren(btnText);
 
                 var line2 = new Button()
                 {
                     Y = rowFrameLayout.Height - 1,
-                    X = Application.GetRealWidth(58),
-                    Width = Application.GetRealWidth(965),
+                    X = Application.GetRealWidth(176),
+                    Width = Application.GetRealWidth(847),
                     Height = 1,
                     BackgroundColor = Shared.Common.ZigbeeColor.Current.XMRowLine,
                 };
@@ -314,7 +316,7 @@
         {
             #region  UI
             FrameLayout flMain = new FrameLayout { BackgroundColor = 0x0f000000 };
-            this.midFrameLayout.AddChidren(flMain);
+            this.AddChidren(flMain);
             flMain.MouseUpEventHandler += (sender11, e11) =>
             {
                 flMain.RemoveFromParent();
@@ -323,24 +325,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);
 
@@ -364,33 +366,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),
+                Width = Application.GetRealWidth(762),
                 Text = Language.StringByID(R.MyInternationalizationString.MatchPerson),
                 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);
 
@@ -466,8 +470,10 @@
                 {
                     if (doorLock.IsFreezeAccount[currentAccount.SubAccountDistributedMark] == true)
                     {
-
-                        new Tip() { MaxWidth = 150, Text = btnUserName.Text + Language.StringByID(R.MyInternationalizationString.AccountIsFreezed), Direction = AMPopTipDirection.Down, CloseTime = 1 }.Show(Common.CommonPage.Instance);
+                        Application.RunOnMainThread(() =>
+                        {
+                            new Tip() { MaxWidth = 150, Text = btnUserName.Text + Language.StringByID(R.MyInternationalizationString.AccountIsFreezed), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance);
+                        });
                         return;
                     }
 
@@ -504,106 +510,134 @@
                 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();
-
-                    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)
-                            {
-                                TypeRefresh();
-                                flMain.RemoveFromParent();
-                                bottomFrameLayout.RemoveAll();
-                            }
-                            else
-                            {
-                                new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.CloudServerResponseOvertime), Direction = AMPopTipDirection.Down, CloseTime = 1 }.Show(Common.CommonPage.Instance);
-                            }
-                        }
-                        else
-                        {
-                            new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.BindFailed), Direction = AMPopTipDirection.Down, CloseTime = 1 }.Show(Common.CommonPage.Instance);
-                            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();
-                    }
-                }
-            };
+            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 (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)
+                                   {
+                                       Application.RunOnMainThread(() =>
+                                       {
+                                           new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.DistributeSuccess), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance);
+                                           TypeRefresh();
+                                           CommonPage.Loading.Hide();
+                                           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 { }
+               });
+           };
         }
 
         // 渚ц竟瀵艰埅鏍�
@@ -644,6 +678,8 @@
                 var rowFrameLayout = new RowLayout()
                 {
                     Height = Application.GetRealHeight(150),
+                    LineColor = Shared.Common.ZigbeeColor.Current.XMRowLine,
+                    X = Application.GetRealWidth(81),
                 };
                 sidelipVerticalScrolViewLayout.AddChidren(rowFrameLayout);
 
@@ -651,8 +687,7 @@
                 {
                     Width = Application.GetRealWidth(81),
                     Height = Application.GetRealHeight(81),
-                    X = Application.GetRealWidth(81),
-                    Y = Application.GetRealHeight(55),
+                    Y = Application.GetRealHeight(35),
                 };
                 rowFrameLayout.AddChidren(btnAllMethod);
 
@@ -660,8 +695,8 @@
                 {
                     Width = Application.GetRealWidth(311),
                     Height = Application.GetRealHeight(58),
-                    X = Application.GetRealWidth(173),
-                    Y = Application.GetRealHeight(69),
+                    X = Application.GetRealWidth(92),
+                    Y = Application.GetRealHeight(49),
                     TextColor = Shared.Common.ZigbeeColor.Current.XMGray3,
                     TextSize = 14,
                     TextAlignment = TextAlignment.CenterLeft,
@@ -685,6 +720,7 @@
                         doorLock.currentUserDisplayMethod = btnMethodText.Text;
                         btnAllMethod.IsSelected = true;
                         oldbuttonText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack;
+                        oldbuttonText.IsBold = true;
                         TypeRefresh();
                     }
                     dialog.Close();
@@ -721,6 +757,7 @@
                 {
                     btnAllMethod.IsSelected = true;
                     btnMethodText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack;
+                    btnMethodText.IsBold = true;
                     oldbutton = btnAllMethod;
                     oldbuttonText = btnMethodText;
                 }
@@ -728,6 +765,7 @@
                 {
                     btnAllMethod.IsSelected = true;
                     btnMethodText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack;
+                    btnMethodText.IsBold = true;
                     oldbutton = btnAllMethod;
                     oldbuttonText = btnMethodText;
                 }
@@ -735,6 +773,7 @@
                 {
                     btnAllMethod.IsSelected = true;
                     btnMethodText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack;
+                    btnMethodText.IsBold = true;
                     oldbutton = btnAllMethod;
                     oldbuttonText = btnMethodText;
                 }
@@ -742,6 +781,7 @@
                 {
                     btnAllMethod.IsSelected = true;
                     btnMethodText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack;
+                    btnMethodText.IsBold = true;
                     oldbutton = btnAllMethod;
                     oldbuttonText = btnMethodText;
                 }
@@ -749,6 +789,7 @@
                 {
                     btnAllMethod.IsSelected = true;
                     btnMethodText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack;
+                    btnMethodText.IsBold = true;
                     oldbutton = btnAllMethod;
                     oldbuttonText = btnMethodText;
                 }

--
Gitblit v1.8.0