HDL Home App 第二版本 旧平台金堂用 正在使用
hxb
2022-08-30 25429f085093d89d543a0b90e30d0d62d1b7dac9
ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UnLockMethod.cs
@@ -25,10 +25,6 @@
                        var doorLock = tempDevice as ZigBee.Device.DoorLock;
                        if (doorLock.doorLockProgrammingEventNotificationCommand != null)
                        {
                            Application.RunOnMainThread(() =>
                            {
                            });
                        }
                    }
                }
@@ -44,16 +40,43 @@
            BackgroundColor = Shared.Common.ZigbeeColor.Current.GXCTopViewBackgroundColor;
        }
        #region ◆ 变量申明__________________________
        ZigBee.Device.DoorLock doorLock;//当前门锁
        VerticalListRefreshControl  bodyView;//刷新View
        Button currentMethod;// 当前选择的方式
        Shared.Phone.UserCenter.MemberInfoRes curAccountObj;//当前账户
        #region 变量申明
        /// <summary>
        /// 当前门锁
        /// </summary>
        ZigBee.Device.DoorLock doorLock;
        /// <summary>
        /// 刷新View
        /// </summary>
        VerticalListRefreshControl bodyView;
        /// <summary>
        /// 当前选择的方式
        /// </summary>
        Button currentMethod;
        /// <summary>
        /// 当前账户
        /// </summary>
        Shared.Phone.UserCenter.MemberInfoRes curAccountObj;
        /// <summary>
        /// 数据为空,UI显示的空图片
        /// </summary>
        Button entryStatusPic;
        /// <summary>
        /// 数据为空,UI显示的文本提示
        /// </summary>
        Button btnPicTip;
        /// <summary>
        /// 数据为空,UI显示的文本提示
        /// </summary>
        Button btnPicTip1;
        bool isSecondDel;//是否二次删除
        FrameLayout blankFrameLayout;//空数据显示布局
        /// <summary>
        /// //是否二次删除
        /// </summary>
        bool isSecondDel;
        /// <summary>
        /// 空数据显示布局
        /// </summary>
        FrameLayout blankFrameLayout;
        #endregion
        /// <summary>
@@ -80,8 +103,12 @@
                {
                    Application.RunOnMainThread(() =>
                    {
                        // 类型区分
                        TypeRefresh();
                        // 类型区分
                        UndateUnlockMethodAction += (obj) =>
                        {
                            RefreshList(obj);
                        };
                        TypeRefresh(doorLock);
                        CommonPage.Loading.Hide();
                        bodyView.EndHeaderRefreshing();
                    });
@@ -89,11 +116,12 @@
            });
        }
        /// <summary>
        /// UI显示
        /// <summary>
        /// UI显示
        /// </summary>
        public void Show()
        {
            UserView.HomePage.Instance.ScrollEnabled = false;
            doorLock.currentUserDisplayMethod = "";
            this.TopFrameLayout(this, Language.StringByID(R.MyInternationalizationString.LockMethod));
            this.btnTitleLine.Visible = false;
@@ -158,7 +186,10 @@
                RefreshList();
            }
        }
        //中部布局
        /// <summary>
        /// 中部布局
        /// </summary>
        void MidFrameLayoutContent()
        {
            #region 开锁方式UI
@@ -178,7 +209,7 @@
                TextAlignment = TextAlignment.CenterRight,
                TextColor = Shared.Common.ZigbeeColor.Current.XMBlack,
                TextSize = 12,
                IsBold =true,
                IsBold = true,
            };
            midTopFrameLayout.AddChidren(btnAllMethod);
            // 类型区分 
@@ -198,6 +229,14 @@
            {
                btnAllMethod.Text = Language.StringByID(R.MyInternationalizationString.ProximithCardUnlock);
            }
            else if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.FaceIDUnlock))
            {
                btnAllMethod.Text = Language.StringByID(R.MyInternationalizationString.FaceIDUnlock);
            }
            else if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.CalmFingerprintUnlock))
            {
                btnAllMethod.Text = Language.StringByID(R.MyInternationalizationString.CalmFingerprintUnlock);
            }
            else
            {
                btnAllMethod.Text = Language.StringByID(R.MyInternationalizationString.AllMethod);
@@ -214,10 +253,16 @@
            };
            midTopFrameLayout.AddChidren(btnNext);
            btnNext.MouseUpEventHandler += (sender, e) =>
            EventHandler<MouseEventArgs> handerSideLip = (sender, e) =>
            {
                SideslipFramelayout();
                SideslipFramelayout(doorLock);
                UndateUnlockMethodAction += (obj) =>
                {
                    RefreshList(obj);
                };
            };
            btnNext.MouseUpEventHandler += handerSideLip;
            btnAllMethod.MouseUpEventHandler += handerSideLip;
            var btnLine = new Button
            {
                Y = midTopFrameLayout.Bottom,
@@ -230,7 +275,7 @@
            bodyView = new VerticalListRefreshControl(29)
            {
                Y = btnLine.Bottom,
                Height = Application.GetRealHeight(1921 - 184 - 116),
                Height = Application.GetRealHeight(1921 - 184 - 116),
            };
            this.midFrameLayout.AddChidren(bodyView);
            bodyView.BeginHeaderRefreshingAction += () =>
@@ -238,7 +283,7 @@
                bodyView.BeginHeaderRefreshing();
                ReadDoorLockUserInfo();
            };
            BlankPicUI();
            BlankPicUI();
        }
        /// <summary>
@@ -259,6 +304,7 @@
                Width = Application.GetRealHeight(757),
                Visible = false,
                UnSelectedImagePath = "DoorLock/UnLockBlankPic.png",
                Gravity = Gravity.CenterHorizontal,
            };
            blankFrameLayout.AddChidren(entryStatusPic);
@@ -276,15 +322,19 @@
            btnPicTip1 = new Button
            {
                X = Application.GetRealWidth(397),
                Y = Application.GetRealHeight(844+49),
                X = Application.GetRealWidth(397),
                Y = Application.GetRealHeight(844 + 49),
                Text = Language.StringByID(R.MyInternationalizationString.NoPasswordInformation1),
                TextColor = Shared.Common.ZigbeeColor.Current.XMGray3,
                Gravity = Gravity.CenterHorizontal,
                Visible = true,
                TextSize =12,
                Visible = true,
                TextSize = 12,
            };
            blankFrameLayout.AddChidren(btnPicTip1);
            if (UserCenterResourse.UserInfo.AuthorityNo != 1)
            {
                btnPicTip1.Width = 0;
            }
        }
        /// <summary>
@@ -302,7 +352,7 @@
            {
                var curDoorLockUser = doorLock.localDoorLockUserList[curUserId];
                if (curDoorLockUser.ConnectedAccount == "" || curDoorLockUser.ConnectedAccount != curAccountObj.SubAccountDistributedMark)
                if (string.IsNullOrEmpty(curDoorLockUser.ConnectedAccount) || curDoorLockUser.ConnectedAccount != curAccountObj.SubAccountDistributedMark)
                {
                    continue;
                }
@@ -334,7 +384,7 @@
                entryStatusPic.Width = Application.GetRealHeight(0);
                btnPicTip.Height = Application.GetRealHeight(0);
                btnPicTip1.Height = Application.GetRealHeight(0);
                blankFrameLayout.Height = Application.GetRealHeight(0);
                blankFrameLayout.Height = Application.GetRealHeight(0);
                int i = 0;
                foreach (var curUserId in curAccountDoorLockUserList.Keys)
@@ -354,6 +404,18 @@
                                continue;
                            }
                            break;
                        case 13:
                            if (curDoorLockUser.UnlockType != unlockMethod)
                            {
                                continue;
                            }
                            break;
                        case 14:
                            if (curDoorLockUser.UnlockType != unlockMethod)
                            {
                                continue;
                            }
                            break;
                        case 15:
                            if (curDoorLockUser.UnlockType != unlockMethod)
                            {
@@ -364,18 +426,16 @@
                            break;
                    }
                    #region UI
                    #region UI
                    var rowFrameLayout = new RowLayoutControl(bodyView.rowSpace / 2);
                    rowFrameLayout.BackgroundColor = ZigbeeColor.Current.XMWhite;
                    bodyView.AddChidren(rowFrameLayout);
                    rowFrameLayout.frameTable.UseClickStatu = false;
                    var btnicon = rowFrameLayout.frameTable.AddLeftIcon();
                    btnicon.UnSelectedImagePath = "DoorLock/DoorLockUserPic.png";
                    //上面门锁用户名称一行
                    //rowFrameLayout.frameTable.AddTopView("", 800);
                    //上面门锁用户名称一行
                    var memberText = "";
                    if (curAccountObj.UserName == "" || curAccountObj.UserName == null)
                    if (string.IsNullOrEmpty(curAccountObj.UserName))
                    {
                        memberText = curAccountObj.Account;
                    }
@@ -401,141 +461,138 @@
                    var btndelete = rowFrameLayout.AddDeleteControl();
                    btndelete.ButtonClickEvent += (sender, e) =>
                    {
                        var dialog = new Dialog { };
                        var doorDialog = new Shared.Phone.UserCenter.DoorLock.DoorlockDialog(dialog, Language.StringByID(R.MyInternationalizationString.Tip));
                        doorDialog.Show();
                        doorDialog.dialogMidFraFrameLayout.Height = Application.GetRealHeight(58);
                        doorDialog.dialogMidFraFrameLayout.X = Application.GetRealWidth(0);
                        doorDialog.dialogMidFraFrameLayout.Y = Application.GetRealHeight(202);
                        doorDialog.dialogMidFraFrameLayout.AddChidren(doorDialog.dialogMidText);
                        doorDialog.dialogMidText.Text = Language.StringByID(R.MyInternationalizationString.SureToDelUnlockMethod);
                        doorDialog.dialogMidFraFrameLayout.AddChidren(doorDialog.dialogMidText);
                        doorDialog.dialogBtnConfirm.Text = Language.StringByID(R.MyInternationalizationString.DoorlockConfirm);
                        doorDialog.dialogBtnCancel.MouseUpEventHandler += (sender1, e1) =>
                        {
                            dialog.Close();
                        };
                        doorDialog.dialogBtnConfirm.MouseUpEventHandler += async (sender1, e1) =>
                        {
                            try
                            {
                                CommonPage.Loading.Start("");
                                var passData = doorLock.SetUserAccessData(curDoorLockUser.UserID, ZigBee.Device.DoorLock.AccessType.DelCurrentUser);
                                var resultData = await doorLock.DefaultControlAsync(passData);
                                if (resultData != null && resultData.defaultControlResponseData != null)
                                {
                                    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;
                                        }
                                        deleteDoorLockData.DoorLockLocalUserId = curDoorLockUser.UserID.ToString();
                                        deleteDoorLockData.PrimaryId = curDoorLockUser.PrimaryId;
                                        deleteDoorLockData.DelDoorLockDelType = 2;
                                        var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/DelDoorLock", deleteDoorLockData);
                                        if (result != null)
                                        {
                                            if (result.StateCode == "Success")
                                            {
                                                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();
                                                    TypeRefresh();
                                                }
                                            }
                                            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.CloudServerResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser);
                                        }
                                    }
                                    else
                                    {
                                        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;
                                            }
                                            deleteDoorLockData.DoorLockLocalUserId = curDoorLockUser.UserID.ToString();
                                            deleteDoorLockData.PrimaryId = curDoorLockUser.PrimaryId;
                                            deleteDoorLockData.DelDoorLockDelType = 2;
                                            var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/DelDoorLock", deleteDoorLockData);
                                            if (result != null)
                                            {
                                                if (result.StateCode == "Success")
                                                {
                                                    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);
                                                        TypeRefresh();
                                                    }
                                                }
                                                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.CloudServerResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser);
                                            }
                                        }
                                        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
                                {
                                    new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 2 }.Show(CommonPage.Instance);
                                }
                                dialog.Close();
                            }
                            catch { }
                            finally
                            {
                                CommonPage.Loading.Hide();
                            }
                        };
                    };
                        string msg = Language.StringByID(R.MyInternationalizationString.SureToDelUnlockMethod);
                        var alert = new Shared.Phone.UserCenter.ShowMsgControl(ShowMsgType.Confirm, msg, Language.StringByID(R.MyInternationalizationString.DoorlockConfirm));
                        alert.Show();
                        //使用确认型弹框时,的回调函数
                        alert.ConfirmClickEvent += async () =>
                         {
                             try
                             {
                                 CommonPage.Loading.Start("");
                                 var passData = doorLock.SetUserAccessData(curDoorLockUser.UserID, ZigBee.Device.DoorLock.AccessType.DelCurrentUser);
                                 var resultData = await doorLock.DefaultControlAsync(passData);
                                 if (resultData != null && resultData.defaultControlResponseData != null)
                                 {
                                     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;
                                         }
                                         deleteDoorLockData.DoorLockLocalUserId = curDoorLockUser.UserID.ToString();
                                         deleteDoorLockData.PrimaryId = curDoorLockUser.PrimaryId;
                                         deleteDoorLockData.DelDoorLockDelType = 2;
                                         var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/DelDoorLock", deleteDoorLockData);
                                         if (result != null)
                                         {
                                             if (result.StateCode == "Success")
                                             {
                                                 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();
                                                     UndateUnlockMethodAction += (obj) =>
                                                     {
                                                         RefreshList(obj);
                                                     };
                                                     TypeRefresh(doorLock);
                                                 }
                                             }
                                             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.CloudServerResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser);
                                         }
                                     }
                                     else
                                     {
                                         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;
                                             }
                                             deleteDoorLockData.DoorLockLocalUserId = curDoorLockUser.UserID.ToString();
                                             deleteDoorLockData.PrimaryId = curDoorLockUser.PrimaryId;
                                             deleteDoorLockData.DelDoorLockDelType = 2;
                                             var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/DelDoorLock", deleteDoorLockData);
                                             if (result != null)
                                             {
                                                 if (result.StateCode == "Success")
                                                 {
                                                     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);
                                                         UndateUnlockMethodAction += (obj) =>
                                                         {
                                                             RefreshList(obj);
                                                         };
                                                         TypeRefresh(doorLock);
                                                     }
                                                 }
                                                 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.CloudServerResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser);
                                             }
                                         }
                                         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
                                 {
                                     new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 2 }.Show(CommonPage.Instance);
                                 }
                             }
                             catch { }
                             finally
                             {
                                 CommonPage.Loading.Hide();
                             }
                         };
                    };
                    #endregion
                    #region 数据处理
@@ -548,7 +605,7 @@
                    switch (curDoorLockUser.UnlockType)
                    {
                        case 0:
                            if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null)
                            if (!string.IsNullOrEmpty(curDoorLockUser.UserName))
                            {
                                btnDoorlockUser.Text = curDoorLockUser.UserName;
                            }
@@ -558,7 +615,7 @@
                            }
                            break;
                        case 3:
                            if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null)
                            if (!string.IsNullOrEmpty(curDoorLockUser.UserName))
                            {
                                btnDoorlockUser.Text = curDoorLockUser.UserName;
                            }
@@ -567,8 +624,28 @@
                                btnDoorlockUser.Text = Language.StringByID(R.MyInternationalizationString.IcCard) + "ID" + curDoorLockUser.UserID;
                            }
                            break;
                        case 13:
                            if (!string.IsNullOrEmpty(curDoorLockUser.UserName))
                            {
                                btnDoorlockUser.Text = curDoorLockUser.UserName;
                            }
                            else
                            {
                                btnDoorlockUser.Text = Language.StringByID(R.MyInternationalizationString.CalmFingerprintMark) + "ID" + +curDoorLockUser.UserID;
                            }
                            break;
                        case 14:
                            if (!string.IsNullOrEmpty(curDoorLockUser.UserName))
                            {
                                btnDoorlockUser.Text = curDoorLockUser.UserName;
                            }
                            else
                            {
                                btnDoorlockUser.Text = Language.StringByID(R.MyInternationalizationString.FaceIDMark) + "ID" + +curDoorLockUser.UserID;
                            }
                            break;
                        case 15:
                            if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null)
                            if (!string.IsNullOrEmpty(curDoorLockUser.UserName))
                            {
                                btnDoorlockUser.Text = curDoorLockUser.UserName;
                            }
@@ -607,11 +684,16 @@
                                     var localDoorLockObj = new ZigBee.Device.DoorLock.LocaDoorLockObj() { };
                                     localDoorLockObj.UserID = curDoorLockUser.UserID;
                                     localDoorLockObj.UnlockType = curDoorLockUser.UnlockType;
                                     localDoorLockObj.PrimaryId = curDoorLockUser.PrimaryId;
                                     localDoorLockObj.EntryTime = curDoorLockUser.EntryTime;
                                     localDoorLockObj.UserName = refreshDoorLockData.UserIdRemarks;
                                     localDoorLockObj.ConnectedAccount = curAccountObj.SubAccountDistributedMark;
                                     doorLock.localDoorLockUserList.Add(curDoorLockUser.UserID, localDoorLockObj);
                                     TypeRefresh();
                                     UndateUnlockMethodAction += (obj1) =>
                                     {
                                         RefreshList(obj1);
                                     };
                                     TypeRefresh(doorLock);
                                 }
                             }
                             else
@@ -625,326 +707,9 @@
                         }
                     };
                    btnDoorlockUser.EditorEnterAction += action;
                    //btnDel.MouseUpEventHandler += (sender, e) =>
                    //{
                    //var dialog = new Dialog { };
                    //var doorDialog = new Shared.Phone.UserCenter.DoorLock.DoorlockDialog(dialog, Language.StringByID(R.MyInternationalizationString.Tip));
                    //doorDialog.Show();
                    //doorDialog.dialogMidFraFrameLayout.Height = Application.GetRealHeight(58);
                    //doorDialog.dialogMidFraFrameLayout.X = Application.GetRealWidth(0);
                    //doorDialog.dialogMidFraFrameLayout.Y = Application.GetRealHeight(202);
                    //doorDialog.dialogMidFraFrameLayout.AddChidren(doorDialog.dialogMidText);
                    //doorDialog.dialogMidText.Text = Language.StringByID(R.MyInternationalizationString.SureToDelUnlockMethod);
                    //doorDialog.dialogMidFraFrameLayout.AddChidren(doorDialog.dialogMidText);
                    //doorDialog.dialogBtnConfirm.Text = Language.StringByID(R.MyInternationalizationString.DoorlockConfirm);
                    //doorDialog.dialogBtnCancel.MouseUpEventHandler += (sender1, e1) =>
                    //{
                    //    dialog.Close();
                    //};
                    //doorDialog.dialogBtnConfirm.MouseUpEventHandler += async (sender1, e1) =>
                    //{
                    //    try
                    //    {
                    //        CommonPage.Loading.Start("");
                    //        var passData = doorLock.SetUserAccessData(curDoorLockUser.UserID, ZigBee.Device.DoorLock.AccessType.DelCurrentUser);
                    //        var resultData = await doorLock.DefaultControlAsync(passData);
                    //        if (resultData != null && resultData.defaultControlResponseData != null)
                    //        {
                    //            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;
                    //                }
                    //                deleteDoorLockData.DoorLockLocalUserId = curDoorLockUser.UserID.ToString();
                    //                deleteDoorLockData.PrimaryId = curDoorLockUser.PrimaryId;
                    //                deleteDoorLockData.DelDoorLockDelType = 2;
                    //                var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/DelDoorLock", deleteDoorLockData);
                    //                if (result != null)
                    //                {
                    //                    if (result.StateCode == "Success")
                    //                    {
                    //                        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();
                    //                            TypeRefresh();
                    //                        }
                    //                    }
                    //                    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.CloudServerResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser);
                    //                }
                    //            }
                    //            else
                    //            {
                    //                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;
                    //                    }
                    //                    deleteDoorLockData.DoorLockLocalUserId = curDoorLockUser.UserID.ToString();
                    //                    deleteDoorLockData.PrimaryId = curDoorLockUser.PrimaryId;
                    //                    deleteDoorLockData.DelDoorLockDelType = 2;
                    //                    var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/DelDoorLock", deleteDoorLockData);
                    //                    if (result != null)
                    //                    {
                    //                        if (result.StateCode == "Success")
                    //                        {
                    //                            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);
                    //                                TypeRefresh();
                    //                            }
                    //                        }
                    //                        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.CloudServerResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser);
                    //                    }
                    //                }
                    //                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
                    //        {
                    //            new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 2 }.Show(btnDel);
                    //        }
                    //        dialog.Close();
                    //    }
                    //    catch { }
                    //    finally
                    //    {
                    //        CommonPage.Loading.Hide();
                    //    }
                    //};
                    //};
                    #endregion
                    i++;
                }
                //bodyView.AdjustRealHeight(Application.GetRealHeight(23));
            }
        }
        // 侧边导航栏
        void SideslipFramelayout()
        {
            var dialog = new Dialog
            {
            };
            dialog.Show();
            var flMain = new FrameLayout { BackgroundColor = 0x00000000 };
            dialog.AddChidren(flMain);
            flMain.MouseUpEventHandler += (sender11, e11) =>
            {
                dialog.Close();
            };
            var sidelipFrameLayout = new FrameLayout()
            {
                Height = Application.GetRealHeight(625),
                Width = Application.GetRealWidth(449),
                Y = Application.GetRealHeight(115 + 160),
                X = Application.GetRealWidth(596),
                BackgroundImagePath = "DoorLock/SideslipPic.png",
            };
            flMain.AddChidren(sidelipFrameLayout);
            var sidelipVerticalScrolViewLayout = new VerticalScrolViewLayout()
            {
                Height = Application.GetRealHeight(600),
                Y = Application.GetRealHeight(28),
            };
            sidelipFrameLayout.AddChidren(sidelipVerticalScrolViewLayout);
            Button oldbutton = null;
            Button oldbuttonText = null;
            for (var i = 0; i < 4; i++)
            {
                var rowFrameLayout = new RowLayout()
                {
                    Height = Application.GetRealHeight(150),
                    LineColor = Shared.Common.ZigbeeColor.Current.XMRowLine,
                    X = Application.GetRealWidth(81),
                };
                sidelipVerticalScrolViewLayout.AddChidren(rowFrameLayout);
                var btnAllMethod = new Button()
                {
                    Width = Application.GetRealWidth(81),
                    Height = Application.GetRealHeight(81),
                    Y = Application.GetRealHeight(35),
                };
                rowFrameLayout.AddChidren(btnAllMethod);
                var btnMethodText = new Button()
                {
                    Width = Application.GetRealWidth(311),
                    Height = Application.GetRealHeight(58),
                    X = Application.GetRealWidth(92),
                    Y = Application.GetRealHeight(49),
                    TextColor = Shared.Common.ZigbeeColor.Current.XMGray3,
                    TextSize = 14,
                    TextAlignment = TextAlignment.CenterLeft,
                };
                rowFrameLayout.AddChidren(btnMethodText);
                EventHandler<MouseEventArgs> hander = (sender, e) =>
                {
                    if (!btnAllMethod.IsSelected)
                    {
                        if (oldbutton != null)
                        {
                            oldbutton.IsSelected = false;
                        }
                        if (oldbuttonText != null)
                        {
                            oldbuttonText.TextColor = Shared.Common.ZigbeeColor.Current.XMGray3;
                        }
                        oldbutton = btnAllMethod;
                        oldbuttonText = btnMethodText;
                        doorLock.currentUserDisplayMethod = btnMethodText.Text;
                        doorLock.ReSave();
                        btnAllMethod.IsSelected = true;
                        oldbuttonText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack;
                        oldbuttonText.IsBold = true;
                        TypeRefresh();
                    }
                    dialog.Close();
                };
                rowFrameLayout.MouseUpEventHandler += hander;
                btnAllMethod.MouseUpEventHandler += hander;
                btnMethodText.MouseUpEventHandler += hander;
                switch (i)
                {
                    case 0:
                        btnAllMethod.UnSelectedImagePath = "DoorLock/AllMethod.png";
                        btnAllMethod.SelectedImagePath = "DoorLock/AllMethodOn.png";
                        btnMethodText.Text = Language.StringByID(R.MyInternationalizationString.AllMethod);
                        break;
                    case 1:
                        btnAllMethod.UnSelectedImagePath = "DoorLock/Password.png";
                        btnAllMethod.SelectedImagePath = "DoorLock/PasswordOn.png";
                        btnMethodText.Text = Language.StringByID(R.MyInternationalizationString.PasswordUnlock);
                        break;
                    case 2:
                        btnAllMethod.UnSelectedImagePath = "DoorLock/Fingerprint.png";
                        btnAllMethod.SelectedImagePath = "DoorLock/FingerprintOn.png";
                        btnMethodText.Text = Language.StringByID(R.MyInternationalizationString.FingerprintUnlock);
                        break;
                    case 3:
                        btnAllMethod.UnSelectedImagePath = "DoorLock/proximityCard.png";
                        btnAllMethod.SelectedImagePath = "DoorLock/proximityCardOn.png";
                        btnMethodText.Text = Language.StringByID(R.MyInternationalizationString.ProximithCardUnlock);
                        break;
                }
                if (doorLock.currentUserDisplayMethod == "" && i == 0)
                {
                    btnAllMethod.IsSelected = true;
                    btnMethodText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack;
                    btnMethodText.IsBold = true;
                    oldbutton = btnAllMethod;
                    oldbuttonText = btnMethodText;
                }
                if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.AllMethod) && i == 0)
                {
                    btnAllMethod.IsSelected = true;
                    btnMethodText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack;
                    btnMethodText.IsBold = true;
                    oldbutton = btnAllMethod;
                    oldbuttonText = btnMethodText;
                }
                if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.PasswordUnlock) && i == 1)
                {
                    btnAllMethod.IsSelected = true;
                    btnMethodText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack;
                    btnMethodText.IsBold = true;
                    oldbutton = btnAllMethod;
                    oldbuttonText = btnMethodText;
                }
                if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.FingerprintUnlock) && i == 2)
                {
                    btnAllMethod.IsSelected = true;
                    btnMethodText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack;
                    btnMethodText.IsBold = true;
                    oldbutton = btnAllMethod;
                    oldbuttonText = btnMethodText;
                }
                if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.ProximithCardUnlock) && i == 3)
                {
                    btnAllMethod.IsSelected = true;
                    btnMethodText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack;
                    btnMethodText.IsBold = true;
                    oldbutton = btnAllMethod;
                    oldbuttonText = btnMethodText;
                }
            }
        }
        //类型区分
        void TypeRefresh()
        {
            if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.PasswordUnlock))
            {
                RefreshList(0);
            }
            else if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.FingerprintUnlock))
            {
                RefreshList(15);
            }
            else if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.ProximithCardUnlock))
            {
                RefreshList(3);
            }
            else
            {
                RefreshList();
            }
        }
@@ -953,19 +718,9 @@
        /// </summary>
        public override void RemoveFromParent()
        {
            UserView.HomePage.Instance.ScrollEnabled = true;
            ZbGateway.StatusList.Remove(this);
            base.RemoveFromParent();
        }
        public void Changed(CommonDevice common)
        {
        }
        public void ChangedILogicStatus(ZigBee.Device.Logic logic)
        {
        }
        public void ChangedISceneStatus(Scene scene)
        {
        }
    }
}