From 16604a593202f2f87adf71abd57d036fe7da3b52 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期一, 18 十一月 2019 10:39:42 +0800
Subject: [PATCH] 同步了全部的代码

---
 ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UnLockMethod.cs |  334 ++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 245 insertions(+), 89 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UnLockMethod.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UnLockMethod.cs
index 53eec42..03c5f3e 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UnLockMethod.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UnLockMethod.cs
@@ -2,11 +2,39 @@
 using System.Collections.Generic;
 using System.ComponentModel;
 using Shared.Common;
+using ZigBee.Device;
 
 namespace Shared.Phone.UserCenter.DoorLock
 {
-    public class UnLockMethod : DoorLockCommonLayout
+    public class UnLockMethod : DoorLockCommonLayout, ZigBee.Common.IStatus
     {
+        /// <summary>
+        /// 澶勭悊鍙樺寲浜嬩欢
+        /// </summary>
+        /// <param name="common"></param>
+        /// <param name="typeTag"></param>
+        public void DeviceInfoChange(CommonDevice tempDevice, string typeTag)
+        {
+            if (typeTag == "DoorLockProgrammingEventNotificationCommand" && tempDevice != null)
+            {
+                if (tempDevice != null)
+                {
+                    if (tempDevice.DeviceEpoint == doorLock.DeviceEpoint
+                                      && tempDevice.DeviceAddr == doorLock.DeviceAddr)
+                    {
+                        var doorLock = tempDevice as ZigBee.Device.DoorLock;
+                        if (doorLock.doorLockProgrammingEventNotificationCommand != null)
+                        {
+
+                            Application.RunOnMainThread(() =>
+                            {
+
+                            });
+                        }
+                    }
+                }
+            }
+        }
         /// 鏋勯�犲嚱鏁�
         /// </summary>
         /// <param name="doorLock"></param>
@@ -28,18 +56,37 @@
         bool isSecondDel;
         #endregion
 
+        void ReadDoorLockUserInfo()
+        {
+            System.Threading.Tasks.Task.Run(async () =>
+            {
+                Application.RunOnMainThread(() => { CommonPage.Loading.Start("Loading..."); });
+                try
+                {
+                    await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetLocaDoorLocklist(doorLock, curAccountObj);
+                }
+                catch { }
+                finally
+                {
+                    Application.RunOnMainThread(() =>
+                    {
+                        RefreshList();
+                        CommonPage.Loading.Hide();
+                    });
+                }
+            });
+        }
 
         /// <summary>
         /// UI鏄剧ず 
         /// </summary>
         public void Show()
         {
-            //ReadDoorLockUserInfo();
             this.TopFrameLayout(this, Language.StringByID(R.MyInternationalizationString.LockMethod));
             this.btnTitleLine.Visible = false;
             EventHandler<MouseEventArgs> eHandlerBack = (sender, e) =>
             {
-                RemoveFromParent();
+                this.RemoveFromParent();
             };
             this.btnBack.MouseUpEventHandler += eHandlerBack;
             this.btnBackFrameLayout.MouseUpEventHandler += eHandlerBack;
@@ -47,7 +94,7 @@
 
             var btnAddFrameLayout = new FrameLayout
             {
-                X = Application.GetRealWidth(953),
+                X = Application.GetRealWidth(953 - 116),
                 Height = Application.GetRealHeight(72),
                 Width = Application.GetRealWidth(72),
             };
@@ -60,14 +107,32 @@
                 UnSelectedImagePath = "DoorLock/AddIcon.png",
             };
             btnAddFrameLayout.AddChidren(btnAdd);
+            if (UserCenterResourse.UserInfo.AuthorityNo != 1)
+            {
+                btnAdd.Width = 0;
+            }
             btnAdd.MouseDownEventHandler += (sender, e) =>
             {
-                var addUnLockMethod = new Shared.Phone.UserCenter.DoorLock.AddUnLockMethod(doorLock, curAccountObj);
-                Shared.Phone.UserView.HomePage.Instance.AddChidren(addUnLockMethod);
-                Shared.Phone.UserView.HomePage.Instance.PageIndex += 1;
-                addUnLockMethod.Show();
+                if (doorLock.IsFreezeAccount[curAccountObj.SubAccountDistributedMark] == true)
+                {
+                    new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.AccountIsFreezed), Direction = AMPopTipDirection.None , CloseTime = 1 }.Show(Common.CommonPage.Instance);
+                }
+                else
+                {
+                    var addUnLockMethod = new Shared.Phone.UserCenter.DoorLock.AddUnLockMethod(doorLock, curAccountObj);
+                    Shared.Phone.UserView.HomePage.Instance.AddChidren(addUnLockMethod);
+                    Shared.Phone.UserView.HomePage.Instance.PageIndex += 1;
+                    addUnLockMethod.Show();
+                }
             };
-
+            if (UserCenterResourse.UserInfo.AuthorityNo == 3)
+            {
+                btnAddFrameLayout.Width = 0;
+            }
+            else
+            {
+                btnAddFrameLayout.Width = Application.GetRealWidth(72);
+            }
             MidFrameLayoutContent();
         }
         //涓儴甯冨眬
@@ -86,8 +151,8 @@
                 Width = Application.GetRealWidth(141 + 100),
                 Y = Application.GetRealHeight(35),
                 X = Application.GetRealWidth(812 - 100),
-                TextAlignment = TextAlignment.Center,
-                Text = Language.StringByID(R.MyInternationalizationString.LockMethod),
+                TextAlignment = TextAlignment.CenterRight,
+                Text = Language.StringByID(R.MyInternationalizationString.AllMethod),
                 TextColor = Shared.Common.ZigbeeColor.Current.XMTopTitleText,
                 TextSize = 12,
             };
@@ -150,6 +215,7 @@
             bodyView = new VerticalScrolViewLayout()
             {
                 Y = btnLine.Bottom,
+                BackgroundColor = Shared.Common.ZigbeeColor.Current.XMWhite,
             };
             this.midFrameLayout.AddChidren(bodyView);
 
@@ -157,8 +223,14 @@
             {
                 SideslipFramelayout();
             };
-
-            RefreshList();
+            if (doorLock.IsFailedToGetDoorLockInfo[curAccountObj.SubAccountDistributedMark] == true)
+            {
+                ReadDoorLockUserInfo();
+            }
+            else
+            {
+                RefreshList();
+            }
         }
 
         /// <summary>
@@ -168,6 +240,11 @@
         /// <param name="key"></param>
         public void RefreshList()
         {
+            if (doorLock.IsFailedToGetDoorLockInfo[curAccountObj.SubAccountDistributedMark] == true)
+            {
+                new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance);
+                return;
+            }
             bodyView.RemoveAll();
             var curAccountDoorLockUserList = new Dictionary<int, ZigBee.Device.DoorLock.LocaDoorLockObj>();
 
@@ -197,17 +274,23 @@
                 btnPicTip.Visible = false;
                 btnPicTip1.Visible = false;
             }
-
+            if (curAccountDoorLockUserList.Keys.Count == 0)
+            {
+                return;
+            }
+            bodyView.Height = curAccountDoorLockUserList.Keys.Count * Application.GetRealHeight(127 + 23);
+            int i = 0;
             foreach (var curUserId in curAccountDoorLockUserList.Keys)
             {
                 var curDoorLockUser = curAccountDoorLockUserList[curUserId];
                 #region UI
                 var rowFrameLayout = new RowLayout()
                 {
-                    Height = Application.GetRealHeight(173),
+                    Height = Application.GetRealHeight(127 + 23),
                     X = Application.GetRealWidth(58),
                     Width = Application.GetRealWidth(965),
                     LineColor = Shared.Common.ZigbeeColor.Current.XMRowLine,
+                    BackgroundColor = Shared.Common.ZigbeeColor.Current.XMWhite,
                 };
                 bodyView.AddChidren(rowFrameLayout);
 
@@ -268,10 +351,16 @@
                 rowFrameLayout.AddRightView(btnDel);
                 #endregion 
                 #region 鏁版嵁澶勭悊
+                int currentIndex = i;
+                if (currentIndex == curAccountDoorLockUserList.Keys.Count - 1)
+                {
+                    rowFrameLayout.LineColor = Shared.Common.ZigbeeColor.Current.XMWhite;
+                }
+
                 switch (curDoorLockUser.UnlockType)
                 {
                     case 0:
-                        if (curDoorLockUser.UserName != "")
+                        if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null)
                         {
                             btnDoorlockUser.Text = curDoorLockUser.UserName;
                         }
@@ -281,7 +370,7 @@
                         }
                         break;
                     case 3:
-                        if (curDoorLockUser.UserName != "")
+                        if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null)
                         {
                             btnDoorlockUser.Text = curDoorLockUser.UserName;
                         }
@@ -291,7 +380,7 @@
                         }
                         break;
                     case 15:
-                        if (curDoorLockUser.UserName != "")
+                        if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null)
                         {
                             btnDoorlockUser.Text = curDoorLockUser.UserName;
                         }
@@ -302,7 +391,7 @@
                         break;
                 }
 
-                if (curAccountObj.UserName == "")
+                if (curAccountObj.UserName == "" || curAccountObj.UserName == null)
                 {
                     btnMember.Text = curAccountObj.Account;
                 }
@@ -319,7 +408,6 @@
                          refreshDoorLockData.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
                          refreshDoorLockData.IsOtherAccountCtrl = true;
                      }
-                     refreshDoorLockData.CloudAccountId = curAccountObj.SubAccountDistributedMark;
                      if (doorLock.DeviceAddr != null)
                      {
                          refreshDoorLockData.DoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint;
@@ -329,24 +417,31 @@
                      refreshDoorLockData.PrimaryId = curDoorLockUser.PrimaryId;
                      refreshDoorLockData.UserIdRemarks = btnDoorlockUser.Text;
                      var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/UpdateDoorLock", refreshDoorLockData);
-                     if (result != null && result.StateCode == "Success")
+                     if (result != null)
                      {
-                         if (doorLock.localDoorLockUserList.ContainsKey(curDoorLockUser.UserID))
+                         if (result.StateCode == "Success")
                          {
-                             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 = refreshDoorLockData.UserIdRemarks;
-                             localDoorLockObj.ConnectedAccount = curAccountObj.SubAccountDistributedMark;
-                             doorLock.localDoorLockUserList.Add(curDoorLockUser.UserID, localDoorLockObj);
-                             RefreshList();
+                             if (doorLock.localDoorLockUserList.ContainsKey(curDoorLockUser.UserID))
+                             {
+                                 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 = refreshDoorLockData.UserIdRemarks;
+                                 localDoorLockObj.ConnectedAccount = curAccountObj.SubAccountDistributedMark;
+                                 doorLock.localDoorLockUserList.Add(curDoorLockUser.UserID, localDoorLockObj);
+                                 RefreshList();
+                             }
+                         }
+                         else
+                         {
+                             new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.ModigfyFailed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser);
                          }
                      }
                      else
                      {
-                         new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.ModigfyFailed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser);
+                         new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.CloudServerResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser);
                      }
                  };
                 btnDoorlockUser.EditorEnterAction += action;
@@ -380,22 +475,31 @@
                                     deleteDoorLockData.PrimaryId = curDoorLockUser.PrimaryId;
                                     deleteDoorLockData.DelDoorLockDelType = 2;
                                     var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/DelDoorLock", deleteDoorLockData);
-                                    if (result != null && result.StateCode == "Success")
+                                    if (result != null)
                                     {
-                                        isSecondDel = false;
-                                        if (doorLock.localDoorLockUserList.ContainsKey(curDoorLockUser.UserID))
+                                        if (result.StateCode == "Success")
                                         {
-                                            doorLock.localDoorLockUserList.Remove(curDoorLockUser.UserID);
-                                            var localDoorLockObj = new ZigBee.Device.DoorLock.LocaDoorLockObj() { };
-                                            localDoorLockObj.UserID = curDoorLockUser.UserID;
-                                            doorLock.localDoorLockUserList.Remove(curUserId);
-                                            RefreshList();
+                                            isSecondDel = false;
+                                            if (doorLock.localDoorLockUserList.ContainsKey(curDoorLockUser.UserID))
+                                            {
+                                                doorLock.localDoorLockAccountList.Remove(curDoorLockUser.ConnectedAccount);
+                                                var localDoorLockObj = new ZigBee.Device.DoorLock.LocaDoorLockObj() { };
+                                                localDoorLockObj.UserID = curDoorLockUser.UserID;
+                                                doorLock.localDoorLockUserList.Remove(curUserId);
+                                                doorLock.ReSave();
+                                                RefreshList();
+                                            }
+                                        }
+                                        else
+                                        {
+                                            //寮�鍏冲浘鏍�
+                                            new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.RemoveFailed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser);
                                         }
                                     }
                                     else
                                     {
                                         isSecondDel = true;
-                                        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.CloudServerResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser);
                                     }
                                 }
                                 else
@@ -416,22 +520,29 @@
                                         deleteDoorLockData.PrimaryId = curDoorLockUser.PrimaryId;
                                         deleteDoorLockData.DelDoorLockDelType = 2;
                                         var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/DelDoorLock", deleteDoorLockData);
-                                        if (result != null && result.StateCode == "Success")
+                                        if (result != null)
                                         {
-                                            isSecondDel = false;
-                                            if (doorLock.localDoorLockUserList.ContainsKey(curDoorLockUser.UserID))
+                                            if (result.StateCode == "Success")
                                             {
-                                                doorLock.localDoorLockUserList.Remove(curDoorLockUser.UserID);
-                                                var localDoorLockObj = new ZigBee.Device.DoorLock.LocaDoorLockObj() { };
-                                                localDoorLockObj.UserID = curDoorLockUser.UserID;
-                                                doorLock.localDoorLockUserList.Remove(curUserId);
-                                                RefreshList();
+                                                isSecondDel = false;
+                                                if (doorLock.localDoorLockUserList.ContainsKey(curDoorLockUser.UserID))
+                                                {
+                                                    doorLock.localDoorLockUserList.Remove(curDoorLockUser.UserID);
+                                                    var localDoorLockObj = new ZigBee.Device.DoorLock.LocaDoorLockObj() { };
+                                                    localDoorLockObj.UserID = curDoorLockUser.UserID;
+                                                    doorLock.localDoorLockUserList.Remove(curUserId);
+                                                    RefreshList();
+                                                }
+                                            }
+                                            else
+                                            {
+                                                new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.RemoveFailed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser);
                                             }
                                         }
                                         else
                                         {
                                             isSecondDel = true;
-                                            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.CloudServerResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser);
                                         }
                                     }
                                     else
@@ -449,12 +560,13 @@
                             }
                             else
                             {
-                                new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.RemoveFailed), Direction = AMPopTipDirection.Up, CloseTime = 2 }.Show(btnDel);
+                                new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 2 }.Show(btnDel);
                             }
                         }
                     };
                 };
-                #endregion 
+                #endregion
+                i++;
             }
         }
 
@@ -651,7 +763,11 @@
                 btnPicTip.Visible = false;
                 btnPicTip1.Visible = false;
             }
-
+            if (curAccountDoorLockUserList.Keys.Count == 0)
+            {
+                return;
+            }
+            int i = 0;
             foreach (var curUserId in curAccountDoorLockUserList.Keys)
             {
                 var curDoorLockUser = curAccountDoorLockUserList[curUserId];
@@ -662,7 +778,7 @@
                 #region UI
                 var rowFrameLayout = new RowLayout()
                 {
-                    Height = Application.GetRealHeight(173),
+                    Height = Application.GetRealHeight(127 + 23),
                     X = Application.GetRealWidth(58),
                     Width = Application.GetRealWidth(965),
                     LineColor = Shared.Common.ZigbeeColor.Current.XMRowLine,
@@ -726,10 +842,15 @@
                 rowFrameLayout.AddRightView(btnDel);
                 #endregion 
                 #region 鏁版嵁澶勭悊
+                int currentIndex = i;
+                if (currentIndex == curAccountDoorLockUserList.Keys.Count - 1)
+                {
+                    rowFrameLayout.LineColor = Shared.Common.ZigbeeColor.Current.XMWhite;
+                }
                 switch (curDoorLockUser.UnlockType)
                 {
                     case 0:
-                        if (curDoorLockUser.UserName != "")
+                        if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null)
                         {
                             btnDoorlockUser.Text = curDoorLockUser.UserName;
                         }
@@ -739,7 +860,7 @@
                         }
                         break;
                     case 3:
-                        if (curDoorLockUser.UserName != "")
+                        if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null)
                         {
                             btnDoorlockUser.Text = curDoorLockUser.UserName;
                         }
@@ -749,7 +870,7 @@
                         }
                         break;
                     case 15:
-                        if (curDoorLockUser.UserName != "")
+                        if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null)
                         {
                             btnDoorlockUser.Text = curDoorLockUser.UserName;
                         }
@@ -760,7 +881,7 @@
                         break;
                 }
 
-                if (curAccountObj.UserName == "")
+                if (curAccountObj.UserName == "" || curAccountObj.UserName == null)
                 {
                     btnMember.Text = curAccountObj.Account;
                 }
@@ -777,7 +898,6 @@
                         refreshDoorLockData.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
                         refreshDoorLockData.IsOtherAccountCtrl = true;
                     }
-                    refreshDoorLockData.CloudAccountId = curAccountObj.SubAccountDistributedMark;
                     if (doorLock.DeviceAddr != null)
                     {
                         refreshDoorLockData.DoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint;
@@ -787,24 +907,31 @@
                     refreshDoorLockData.PrimaryId = curDoorLockUser.PrimaryId;
                     refreshDoorLockData.UserIdRemarks = btnDoorlockUser.Text;
                     var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/UpdateDoorLock", refreshDoorLockData);
-                    if (result != null && result.StateCode == "Success")
+                    if (result != null)
                     {
-                        if (doorLock.localDoorLockUserList.ContainsKey(curDoorLockUser.UserID))
+                        if (result.StateCode == "Success")
                         {
-                            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 = refreshDoorLockData.UserIdRemarks;
-                            localDoorLockObj.ConnectedAccount = curAccountObj.SubAccountDistributedMark;
-                            doorLock.localDoorLockUserList.Add(curDoorLockUser.UserID, localDoorLockObj);
-                            RefreshList();
+                            if (doorLock.localDoorLockUserList.ContainsKey(curDoorLockUser.UserID))
+                            {
+                                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 = refreshDoorLockData.UserIdRemarks;
+                                localDoorLockObj.ConnectedAccount = curAccountObj.SubAccountDistributedMark;
+                                doorLock.localDoorLockUserList.Add(curDoorLockUser.UserID, localDoorLockObj);
+                                RefreshList();
+                            }
+                        }
+                        else
+                        {
+                            new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.ModigfyFailed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser);
                         }
                     }
                     else
                     {
-                        new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.ModigfyFailed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser);
+                        new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.CloudServerResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser);
                     }
                 };
                 btnDoorlockUser.EditorEnterAction += action;
@@ -838,29 +965,34 @@
                                     deleteDoorLockData.PrimaryId = curDoorLockUser.PrimaryId;
                                     deleteDoorLockData.DelDoorLockDelType = 2;
                                     var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/DelDoorLock", deleteDoorLockData);
-                                    if (result != null && result.StateCode == "Success")
+                                    if (result != null)
                                     {
-                                        if (doorLock.localDoorLockUserList.ContainsKey(curDoorLockUser.UserID))
+                                        if (result.StateCode == "Success")
                                         {
-                                            doorLock.localDoorLockUserList.Remove(curDoorLockUser.UserID);
-                                            var localDoorLockObj = new ZigBee.Device.DoorLock.LocaDoorLockObj() { };
-                                            localDoorLockObj.UserID = curDoorLockUser.UserID;
-
-                                            //new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.RemoveSuccess), Direction = AMPopTipDirection.Up, CloseTime = 2 }.Show(btnDel);
-                                            doorLock.localDoorLockUserList.Remove(curUserId);
-                                            RefreshList();
+                                            if (doorLock.localDoorLockUserList.ContainsKey(curDoorLockUser.UserID))
+                                            {
+                                                doorLock.localDoorLockUserList.Remove(curDoorLockUser.UserID);
+                                                var localDoorLockObj = new ZigBee.Device.DoorLock.LocaDoorLockObj() { };
+                                                localDoorLockObj.UserID = curDoorLockUser.UserID;
+                                                doorLock.localDoorLockUserList.Remove(curUserId);
+                                                RefreshList();
+                                            }
+                                        }
+                                        else
+                                        {
+                                            if (curDoorLockUser.UserID < 10)
+                                            {
+                                                new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.OnlyBeDeletedOnTheDevice), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser);
+                                            }
+                                            else
+                                            {
+                                                new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.RemoveFailed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser);
+                                            }
                                         }
                                     }
                                     else
                                     {
-                                        if (curDoorLockUser.UserID < 10)
-                                        {
-
-                                        }
-                                        else
-                                        {
-                                            new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.ModigfyFailed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser);
-                                        }
+                                        new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.CloudServerResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser);
                                     }
                                 }
                                 else
@@ -871,14 +1003,38 @@
                             }
                             else
                             {
-                                new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.RemoveFailed), Direction = AMPopTipDirection.Up, CloseTime = 2 }.Show(btnDel);
+                                new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 2 }.Show(btnDel);
                             }
                         }
                     };
                 };
                 #endregion
+                i++;
             }
+
+            bodyView.Height = i * Application.GetRealHeight(127 + 23);
         }
 
+        /// <summary>
+        /// 閲嶅啓绉婚櫎鏂规硶
+        /// </summary>
+        public override void RemoveFromParent()
+        {
+            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