From a4d525d08da7b6fb985b0069c539c11b06306a9b Mon Sep 17 00:00:00 2001
From: WJC <wjc@hdlchina.com.cn>
Date: 星期三, 13 十一月 2019 16:28:34 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev-tzy' into dev-wjc

---
 ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UnLockMethod.cs |  326 ++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 241 insertions(+), 85 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UnLockMethod.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UnLockMethod.cs
old mode 100644
new mode 100755
index f6bbed0..505e6ea
--- 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鏄剧ず 
+        /// 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) =>
+        {
+            if (doorLock.IsFreezeAccount[curAccountObj.SubAccountDistributedMark] == true)
+            {
+                new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.AccountIsFreezed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(this.btnTip);
+            }
+            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();
         }
         //涓儴甯冨眬
@@ -149,7 +214,8 @@
 
             bodyView = new VerticalScrolViewLayout()
             {
-                Y = btnLine.Bottom,
+                Y = midTopFrameLayout.Bottom,
+                Height = Application.GetRealHeight(1921 - 184 - 115 - 1),
             };
             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.Up, CloseTime = 1 }.Show(this.btnTip);
+                return;
+            }
             bodyView.RemoveAll();
             var curAccountDoorLockUserList = new Dictionary<int, ZigBee.Device.DoorLock.LocaDoorLockObj>();
 
@@ -266,12 +343,12 @@
                     BackgroundColor = Shared.Common.ZigbeeColor.Current.XMDel,
                 };
                 rowFrameLayout.AddRightView(btnDel);
-                #endregion 
+                #endregion
                 #region 鏁版嵁澶勭悊
                 switch (curDoorLockUser.UnlockType)
                 {
                     case 0:
-                        if (curDoorLockUser.UserName != "")
+                        if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null)
                         {
                             btnDoorlockUser.Text = curDoorLockUser.UserName;
                         }
@@ -281,7 +358,7 @@
                         }
                         break;
                     case 3:
-                        if (curDoorLockUser.UserName != "")
+                        if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null)
                         {
                             btnDoorlockUser.Text = curDoorLockUser.UserName;
                         }
@@ -291,7 +368,7 @@
                         }
                         break;
                     case 15:
-                        if (curDoorLockUser.UserName != "")
+                        if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null)
                         {
                             btnDoorlockUser.Text = curDoorLockUser.UserName;
                         }
@@ -302,7 +379,7 @@
                         break;
                 }
 
-                if (curAccountObj.UserName == "")
+                if (curAccountObj.UserName == "" || curAccountObj.UserName == null)
                 {
                     btnMember.Text = curAccountObj.Account;
                 }
@@ -314,7 +391,11 @@
                 Action<Shared.View> action = async (obj) =>
                  {
                      var refreshDoorLockData = new ZigBee.Device.DoorLock.RefreshDoorLockData();
-                     refreshDoorLockData.CloudAccountId = curAccountObj.SubAccountDistributedMark;
+                     if (UserCenterResourse.UserInfo.AuthorityNo != 1)
+                     {
+                         refreshDoorLockData.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
+                         refreshDoorLockData.IsOtherAccountCtrl = true;
+                     }
                      if (doorLock.DeviceAddr != null)
                      {
                          refreshDoorLockData.DoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint;
@@ -324,24 +405,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;
@@ -362,6 +450,11 @@
                                 if (resultData.defaultControlResponseData.status == 0 || resultData.defaultControlResponseData.status == 2)
                                 {
                                     var deleteDoorLockData = new ZigBee.Device.DoorLock.DeleteDoorLockData();
+                                    if (UserCenterResourse.UserInfo.AuthorityNo != 1)
+                                    {
+                                        deleteDoorLockData.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
+                                        deleteDoorLockData.IsOtherAccountCtrl = true;
+                                    }
                                     if (doorLock.DeviceAddr != null)
                                     {
                                         deleteDoorLockData.DoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint;
@@ -370,22 +463,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
@@ -393,6 +495,11 @@
                                     if (isSecondDel)
                                     {
                                         var deleteDoorLockData = new ZigBee.Device.DoorLock.DeleteDoorLockData();
+                                        if (UserCenterResourse.UserInfo.AuthorityNo != 1)
+                                        {
+                                            deleteDoorLockData.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
+                                            deleteDoorLockData.IsOtherAccountCtrl = true;
+                                        }
                                         if (doorLock.DeviceAddr != null)
                                         {
                                             deleteDoorLockData.DoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint;
@@ -401,22 +508,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
@@ -434,12 +548,12 @@
                             }
                             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
             }
         }
 
@@ -523,7 +637,7 @@
                         btnAllMethod.IsSelected = true;
                         oldbuttonText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack;
 
-                        // 绫诲瀷鍖哄垎 
+                        // 绫诲瀷鍖哄垎
                         if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.AllMethod))
                         {
                             RefreshList();
@@ -709,12 +823,12 @@
                     BackgroundColor = Shared.Common.ZigbeeColor.Current.XMDel,
                 };
                 rowFrameLayout.AddRightView(btnDel);
-                #endregion 
+                #endregion
                 #region 鏁版嵁澶勭悊
                 switch (curDoorLockUser.UnlockType)
                 {
                     case 0:
-                        if (curDoorLockUser.UserName != "")
+                        if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null)
                         {
                             btnDoorlockUser.Text = curDoorLockUser.UserName;
                         }
@@ -724,7 +838,7 @@
                         }
                         break;
                     case 3:
-                        if (curDoorLockUser.UserName != "")
+                        if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null)
                         {
                             btnDoorlockUser.Text = curDoorLockUser.UserName;
                         }
@@ -734,7 +848,7 @@
                         }
                         break;
                     case 15:
-                        if (curDoorLockUser.UserName != "")
+                        if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null)
                         {
                             btnDoorlockUser.Text = curDoorLockUser.UserName;
                         }
@@ -745,7 +859,7 @@
                         break;
                 }
 
-                if (curAccountObj.UserName == "")
+                if (curAccountObj.UserName == "" || curAccountObj.UserName == null)
                 {
                     btnMember.Text = curAccountObj.Account;
                 }
@@ -757,7 +871,11 @@
                 Action<Shared.View> action = async (obj) =>
                 {
                     var refreshDoorLockData = new ZigBee.Device.DoorLock.RefreshDoorLockData();
-                    refreshDoorLockData.CloudAccountId = curAccountObj.SubAccountDistributedMark;
+                    if (UserCenterResourse.UserInfo.AuthorityNo != 1)
+                    {
+                        refreshDoorLockData.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
+                        refreshDoorLockData.IsOtherAccountCtrl = true;
+                    }
                     if (doorLock.DeviceAddr != null)
                     {
                         refreshDoorLockData.DoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint;
@@ -767,24 +885,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;
@@ -805,6 +930,11 @@
                                 if (resultData.defaultControlResponseData.status == 0)
                                 {
                                     var deleteDoorLockData = new ZigBee.Device.DoorLock.DeleteDoorLockData();
+                                    if (UserCenterResourse.UserInfo.AuthorityNo != 1)
+                                    {
+                                        deleteDoorLockData.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
+                                        deleteDoorLockData.IsOtherAccountCtrl = true;
+                                    }
                                     if (doorLock.DeviceAddr != null)
                                     {
                                         deleteDoorLockData.DoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint;
@@ -813,29 +943,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
@@ -846,7 +981,7 @@
                             }
                             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);
                             }
                         }
                     };
@@ -855,5 +990,26 @@
             }
         }
 
+        /// <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