From 2109463fab2eb1caed189e4f258e0e763c5cea7b Mon Sep 17 00:00:00 2001
From: WJC <wjc@hdlchina.com.cn>
Date: 星期四, 07 十一月 2019 11:58:53 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev-tzy' into dev-wjc

---
 ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UndistributeDoorlockUserPage.cs |  159 ++++++++++++++++++++++++++++++----------------------
 1 files changed, 92 insertions(+), 67 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UndistributeDoorlockUserPage.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UndistributeDoorlockUserPage.cs
index a2400e0..7b5c669 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UndistributeDoorlockUserPage.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UndistributeDoorlockUserPage.cs
@@ -64,7 +64,6 @@
                             {
                                 localDoorLockObj.DoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint;
                             }
-
                             var getDoorLockInfoList = await ZigBee.Device.DoorLock.GetDoorLockInfoFromServer("DoorLock/GetDoorLockPager", localDoorLockObj);
                             if (getDoorLockInfoList != null)
                             {
@@ -84,11 +83,21 @@
                                     doorLock.localDoorLockUserList.Add(int.Parse(curDoorLockUser.DoorLockLocalUserId), doorLockObj);
                                 }
                             }
+                            else
+                            {
+                                Application.RunOnMainThread(() =>
+                                {
+                                    new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.CloudServerResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(this.btnTip);
+                                });
+                            }
                         }
                     }
                     else
                     {
-
+                        Application.RunOnMainThread(() =>
+                        {
+                            new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(this.btnTip);
+                        });
                     }
                 }
                 catch { }
@@ -96,7 +105,7 @@
                 {
                     Application.RunOnMainThread(() =>
                     {
-                        RefreshList();
+                        MidFrameLayoutContent();
                         CommonPage.Loading.Hide();
                     });
                 }
@@ -113,16 +122,62 @@
             EventHandler<MouseEventArgs> eHandlerBack = (sender, e) =>
             {
                 RemoveFromParent();
+                this.btnTip.Visible = false;
             };
             this.btnBack.MouseUpEventHandler += eHandlerBack;
             this.btnBackFrameLayout.MouseUpEventHandler += eHandlerBack;
             this.MidFrameLayout(this);
 
-            MidFrameLayoutContent();
             ReadDoorLockUserInfo();
         }
 
-        public void RefreshList()
+        public void MidFrameLayoutContent()
+        {
+            var midTopFrameLayout = new FrameLayout()
+            {
+                Height = Application.GetRealHeight(115),
+                BackgroundColor = Shared.Common.ZigbeeColor.Current.XMTopFrameLayout,
+            };
+            this.midFrameLayout.AddChidren(midTopFrameLayout);
+
+            var btnAllMethod = new Button()
+            {
+                Height = Application.GetRealHeight(49),
+                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,
+                TextSize = 12,
+            };
+            midTopFrameLayout.AddChidren(btnAllMethod);
+
+            var btnNext = new Button()
+            {
+                X = Application.GetRealWidth(953),
+                Y = Application.GetRealHeight(20),
+                Height = Application.GetRealHeight(69),
+                Width = Application.GetRealWidth(69),
+                UnSelectedImagePath = "DoorLock/UnLockSideslipIcon.png",
+                SelectedImagePath = "DoorLock/UnLockSideslipIcon.png",
+            };
+            midTopFrameLayout.AddChidren(btnNext);
+            btnNext.MouseUpEventHandler += (sender, e) =>
+            {
+                SideslipFramelayout();
+            };
+
+            bodyView = new VerticalScrolViewLayout()
+            {
+                Y = midTopFrameLayout.Bottom,
+            };
+            this.midFrameLayout.AddChidren(bodyView);
+
+            RefreshList();
+        }
+
+        void RefreshList()
         {
             bodyView.RemoveAll();
             foreach (var curUserId in doorLock.localDoorLockUserList.Keys)
@@ -185,7 +240,7 @@
                 switch (curDoorLockUser.UnlockType)
                 {
                     case 0:
-                        if (curDoorLockUser.UserName != "")
+                        if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null)
                         {
                             btnText.Text = curDoorLockUser.UserName;
                         }
@@ -195,7 +250,7 @@
                         }
                         break;
                     case 3:
-                        if (curDoorLockUser.UserName != "")
+                        if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null)
                         {
                             btnText.Text = curDoorLockUser.UserName;
                         }
@@ -205,7 +260,7 @@
                         }
                         break;
                     case 15:
-                        if (curDoorLockUser.UserName != "")
+                        if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null)
                         {
                             btnText.Text = curDoorLockUser.UserName;
                         }
@@ -228,54 +283,8 @@
             }
         }
 
-        public void MidFrameLayoutContent()
-        {
-            var midTopFrameLayout = new FrameLayout()
-            {
-                Height = Application.GetRealHeight(115),
-                BackgroundColor = Shared.Common.ZigbeeColor.Current.XMTopFrameLayout,
-            };
-            this.midFrameLayout.AddChidren(midTopFrameLayout);
-
-            var btnAllMethod = new Button()
-            {
-                Height = Application.GetRealHeight(49),
-                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,
-                TextSize = 12,
-            };
-            midTopFrameLayout.AddChidren(btnAllMethod);
-
-            var btnNext = new Button()
-            {
-                X = Application.GetRealWidth(953),
-                Y = Application.GetRealHeight(20),
-                Height = Application.GetRealHeight(69),
-                Width = Application.GetRealWidth(69),
-                UnSelectedImagePath = "DoorLock/UnLockSideslipIcon.png",
-                SelectedImagePath = "DoorLock/UnLockSideslipIcon.png",
-            };
-            midTopFrameLayout.AddChidren(btnNext);
-            btnNext.MouseUpEventHandler += (sender, e) =>
-            {
-                SideslipFramelayout();
-            };
-
-            bodyView = new VerticalScrolViewLayout()
-            {
-                Y = midTopFrameLayout.Bottom,
-            };
-            this.midFrameLayout.AddChidren(bodyView);
-
-            RefreshList();
-        }
-
         //鏈湴璐︽埛
-        public void MatchUsersFrameLayout(ZigBee.Device.DoorLock.LocaDoorLockObj curDoorLockUser)
+        void MatchUsersFrameLayout(ZigBee.Device.DoorLock.LocaDoorLockObj curDoorLockUser)
         {
             #region  UI
             FrameLayout flMain = new FrameLayout { BackgroundColor = 0x0f000000 };
@@ -429,6 +438,13 @@
 
                 EventHandler<MouseEventArgs> eHandler = (sender, e) =>
                 {
+                    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);
+                        return;
+                    }
+
                     if (!btnChoose.IsSelected)
                     {
                         if (oldbuttonChoose != null)
@@ -488,7 +504,7 @@
                     switch (curDoorLockUser.UnlockType)
                     {
                         case 0:
-                            if (curDoorLockUser.UserName != "")
+                            if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null)
                             {
                                 addLockInfo.UserIdRemarks = curDoorLockUser.UserName;
                             }
@@ -498,7 +514,7 @@
                             }
                             break;
                         case 3:
-                            if (curDoorLockUser.UserName != "")
+                            if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null)
                             {
                                 addLockInfo.UserIdRemarks = curDoorLockUser.UserName;
                             }
@@ -508,7 +524,7 @@
                             }
                             break;
                         case 15:
-                            if (curDoorLockUser.UserName != "")
+                            if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null)
                             {
                                 addLockInfo.UserIdRemarks = curDoorLockUser.UserName;
                             }
@@ -523,20 +539,29 @@
                     var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/AddDoorLock", addLockInfo);
                     if (result != null && result.StateCode == "Success")
                     {
-                        if (doorLock.localDoorLockUserList.ContainsKey(curDoorLockUser.UserID))
+                        //瀛樿处鎴蜂俊鎭�
+                        //var resultList1 = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetCloudLocalAccountlist(doorLock, curAccountId);
+                        //瀛橀棬閿佷俊鎭�
+                        var resultList = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetCloudLocalDoorLocklist(doorLock, curAccountId);
+                        var uList = new List<int> { };
+                        if (resultList != null)
                         {
-                            doorLock.localDoorLockUserList.Remove(curDoorLockUser.UserID);
-                            var localDoorLockObj = new ZigBee.Device.DoorLock.LocaDoorLockObj() { };
-                            localDoorLockObj.UserID = curDoorLockUser.UserID;
-                            localDoorLockObj.UnlockType = curDoorLockUser.UnlockType;
-                            localDoorLockObj.EntryTime = curDoorLockUser.EntryTime;
-                            localDoorLockObj.UserName = curDoorLockUser.UserName;
-                            localDoorLockObj.ConnectedAccount = curAccountId;
-                            doorLock.localDoorLockUserList.Add(curDoorLockUser.UserID, localDoorLockObj);
+                            foreach (var a in resultList.Keys)
+                            {
+                                uList.Add(a);
+                            }
+                        }
+                        var d = uList.Find((value) => { return value == doorLock.doorLockProgrammingEventNotificationCommand.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
                     {

--
Gitblit v1.8.0