黄学彪
2020-12-17 9f326f4000847e6167d8166fa2f6a66f53cb3734
ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UnLockMethod.cs
@@ -25,11 +25,6 @@
                        var doorLock = tempDevice as ZigBee.Device.DoorLock;
                        if (doorLock.doorLockProgrammingEventNotificationCommand != null)
                        {
                            Application.RunOnMainThread(() =>
                            {
                            });
                        }
                    }
                }
@@ -38,23 +33,50 @@
        /// 构造函数
        /// </summary>
        /// <param name="doorLock"></param>
        public UnLockMethod(ZigBee.Device.DoorLock doorLock, Shared.Phone.UserCenter.MemberInfoRes accountObj)
        public UnLockMethod(ZigBee.Device.DoorLock doorLock, MemberInfoRes accountObj)
        {
            this.doorLock = doorLock;
            this.curAccountObj = accountObj;
            BackgroundColor = Shared.Common.ZigbeeColor.Current.GXCTopViewBackgroundColor;
        }
        #region ◆ 变量申明__________________________
        ZigBee.Device.DoorLock doorLock;//当前门锁
        VerticalRefreshLayout 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>
        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>
@@ -66,15 +88,16 @@
            {
                try
                {
                    var list = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetDoorLockAllAcountUserlist(doorLock);
                    if (doorLock.IsFailedToGetDoorLockInfo[curAccountObj.SubAccountDistributedMark] == true)
                    {
                        //数据如果在门锁上面是空的时候,数据也是没有的
                        Application.RunOnMainThread(() =>
                        {
                            new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance);
                        });
                    }
                    //☆マーク☆
                    //var list = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetDoorLockAllAcountUserlist(doorLock);
                    //if (doorLock.IsFailedToGetDoorLockInfo[curAccountObj.SubAccountDistributedMark] == true)
                    //{
                    //    //数据如果在门锁上面是空的时候,数据也是没有的
                    //    Application.RunOnMainThread(() =>
                    //    {
                    //        new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance);
                    //    });
                    //}
                }
                catch { }
                finally
@@ -84,16 +107,18 @@
                        // 类型区分 
                        TypeRefresh();
                        CommonPage.Loading.Hide();
                        bodyView.EndHeaderRefreshing();
                    });
                }
            });
        }
        /// <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;
@@ -120,25 +145,26 @@
                UnSelectedImagePath = "DoorLock/AddIcon.png",
            };
            btnAddFrameLayout.AddChidren(btnAdd);
            if (UserCenterResourse.UserInfo.AuthorityNo != 1)
            if (HdlUserCenterResourse.ResidenceOption.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.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 (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)
            if (HdlUserCenterResourse.ResidenceOption.AuthorityNo == 3)
            {
                btnAddFrameLayout.Width = 0;
            }
@@ -148,17 +174,21 @@
            }
            MidFrameLayoutContent();
            if (doorLock.IsFailedToGetDoorLockInfo[curAccountObj.SubAccountDistributedMark] == true)
            {
                CommonPage.Loading.Start("Loading...");
                ReadDoorLockUserInfo();
            }
            else
            {
                RefreshList();
            }
            //☆マーク☆
            //if (doorLock.IsFailedToGetDoorLockInfo[curAccountObj.SubAccountDistributedMark] == true)
            //{
            //    CommonPage.Loading.Start("Loading...");
            //    ReadDoorLockUserInfo();
            //}
            //else
            //{
            //    RefreshList();
            //}
        }
        //中部布局
        /// <summary>
        /// 中部布局
        /// </summary>
        void MidFrameLayoutContent()
        {
            #region 开锁方式UI
@@ -176,8 +206,9 @@
                Y = Application.GetRealHeight(35),
                X = Application.GetRealWidth(812 - 100),
                TextAlignment = TextAlignment.CenterRight,
                TextColor = Shared.Common.ZigbeeColor.Current.XMTopTitleText,
                TextColor = Shared.Common.ZigbeeColor.Current.XMBlack,
                TextSize = 12,
                IsBold = true,
            };
            midTopFrameLayout.AddChidren(btnAllMethod);
            // 类型区分 
@@ -213,10 +244,12 @@
            };
            midTopFrameLayout.AddChidren(btnNext);
            btnNext.MouseUpEventHandler += (sender, e) =>
            EventHandler<MouseEventArgs> handerSideLip = (sender, e) =>
            {
                SideslipFramelayout();
            };
            btnNext.MouseUpEventHandler += handerSideLip;
            btnAllMethod.MouseUpEventHandler += handerSideLip;
            var btnLine = new Button
            {
                Y = midTopFrameLayout.Bottom,
@@ -226,7 +259,7 @@
            this.midFrameLayout.AddChidren(btnLine);
            #endregion
            bodyView = new VerticalRefreshLayout()
            bodyView = new VerticalListRefreshControl(29)
            {
                Y = btnLine.Bottom,
                Height = Application.GetRealHeight(1921 - 184 - 116),
@@ -236,7 +269,6 @@
            {
                bodyView.BeginHeaderRefreshing();
                ReadDoorLockUserInfo();
                bodyView.EndHeaderRefreshing();
            };
            BlankPicUI();
        }
@@ -259,6 +291,7 @@
                Width = Application.GetRealHeight(757),
                Visible = false,
                UnSelectedImagePath = "DoorLock/UnLockBlankPic.png",
                Gravity = Gravity.CenterHorizontal,
            };
            blankFrameLayout.AddChidren(entryStatusPic);
@@ -270,20 +303,25 @@
                Gravity = Gravity.CenterHorizontal,
                Visible = false,
                Y = Application.GetRealHeight(844),
                TextSize = 12,
            };
            blankFrameLayout.AddChidren(btnPicTip);
            btnPicTip1 = new Button
            {
                X = Application.GetRealWidth(397),
                Y = btnPicTip.Bottom,
                Y = Application.GetRealHeight(844 + 49),
                Text = Language.StringByID(R.MyInternationalizationString.NoPasswordInformation1),
                TextColor = Shared.Common.ZigbeeColor.Current.XMGray3,
                Gravity = Gravity.CenterHorizontal,
                Visible = false,
                BackgroundColor = 0xff00ff00,
                Visible = true,
                TextSize = 12,
            };
            blankFrameLayout.AddChidren(btnPicTip1);
            if (HdlUserCenterResourse.ResidenceOption.AuthorityNo != 1)
            {
                btnPicTip1.Width = 0;
            }
        }
        /// <summary>
@@ -300,15 +338,15 @@
            foreach (var curUserId in doorLock.localDoorLockUserList.Keys)
            {
                var curDoorLockUser = doorLock.localDoorLockUserList[curUserId];
                if (curDoorLockUser.ConnectedAccount == "" || curDoorLockUser.ConnectedAccount != curAccountObj.SubAccountDistributedMark)
                {
                    continue;
                }
                else
                {
                    curAccountDoorLockUserList.Add(curDoorLockUser.UserID, curDoorLockUser);
                }
                //☆マーク☆
                //if (string.IsNullOrEmpty(curDoorLockUser.ConnectedAccount) || curDoorLockUser.ConnectedAccount != curAccountObj.SubAccountDistributedMark)
                //{
                //    continue;
                //}
                //else
                //{
                //    curAccountDoorLockUserList.Add(curDoorLockUser.UserID, curDoorLockUser);
                //}
            }
            if (curAccountDoorLockUserList.Count == 0)
@@ -334,12 +372,6 @@
                btnPicTip.Height = Application.GetRealHeight(0);
                btnPicTip1.Height = Application.GetRealHeight(0);
                blankFrameLayout.Height = Application.GetRealHeight(0);
                var frameLayoutRow = new FrameLayout()
                {
                    Height = Application.GetMinRealAverage(0),
                    BackgroundColor = Shared.Common.ZigbeeColor.Current.XMWhite,
                };
                bodyView.AddChidren(frameLayoutRow);
                int i = 0;
                foreach (var curUserId in curAccountDoorLockUserList.Keys)
@@ -369,70 +401,160 @@
                            break;
                    }
                    #region UI
                    var rowFrameLayout = new RowLayout()
                    {
                        Height = Application.GetRealHeight(127 + 23),
                        X = Application.GetRealWidth(58),
                        Y = i * Application.GetRealHeight(150),
                        Width = Application.GetRealWidth(965),
                        LineColor = Shared.Common.ZigbeeColor.Current.XMRowLine,
                        BackgroundColor = Shared.Common.ZigbeeColor.Current.XMWhite,
                    };
                    frameLayoutRow.AddChidren(rowFrameLayout);
                    #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";
                    //上面门锁用户名称一行
                    var memberText = curAccountObj.ShowName;
                    var btnPicFrameLayout = new FrameLayout()
                    {
                        Width = Application.GetRealWidth(81),
                        Height = Application.GetRealHeight(81),
                        X = Application.GetRealWidth(40),
                        Y = Application.GetRealHeight(49),
                    };
                    rowFrameLayout.AddChidren(btnPicFrameLayout);
                    var btnPic = new Button()
                    {
                        Width = Application.GetRealWidth(84),
                        Height = Application.GetRealHeight(84),
                        UnSelectedImagePath = "DoorLock/DoorLockUserPic.png",
                    };
                    btnPicFrameLayout.AddChidren(btnPic);
                    //成员一行
                    var btnaa = rowFrameLayout.frameTable.AddBottomView(memberText, 800);
                    var btnDoorlockUser = new EditText()
                    {
                        Width = Application.GetRealWidth(1080 - 173),
                        Width = Application.GetRealWidth(800),
                        Height = Application.GetRealHeight(60),
                        X = Application.GetRealWidth(173),
                        Y = Application.GetRealHeight(35),
                        X = btnaa.X,
                        Y = rowFrameLayout.chidrenYaxis + Application.GetRealHeight(12),
                        TextSize = 14,
                        PlaceholderTextColor = Shared.Common.ZigbeeColor.Current.XMGray3,
                        TextColor = Shared.Common.ZigbeeColor.Current.XMBlack,
                        TextAlignment = TextAlignment.CenterLeft,
                    };
                    rowFrameLayout.AddChidren(btnDoorlockUser);
                    var btnMember = new Button()
                    rowFrameLayout.frameTable.AddChidren(btnDoorlockUser, ChidrenBindMode.NotBind);
                    rowFrameLayout.frameTable.AddBottomLine();
                    var btndelete = rowFrameLayout.AddDeleteControl();
                    btndelete.ButtonClickEvent += (sender, e) =>
                    {
                        Width = Application.GetRealWidth(1080 - 173),
                        Height = Application.GetRealHeight(49),
                        X = Application.GetRealWidth(173),
                        Y = Application.GetRealHeight(95),
                        TextColor = Shared.Common.ZigbeeColor.Current.XMGray3,
                        TextSize = 14,
                        TextAlignment = TextAlignment.CenterLeft,
                        string msg = Language.StringByID(R.MyInternationalizationString.SureToDelUnlockMethod);
                        var alert = new 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 (HdlUserCenterResourse.ResidenceOption.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.Code == HttpMessageEnum.A成功)
                                             {
                                                 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 (HdlUserCenterResourse.ResidenceOption.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.Code == HttpMessageEnum.A成功)
                                                 {
                                                     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);
                                 }
                             }
                             catch { }
                             finally
                             {
                                 CommonPage.Loading.Hide();
                             }
                         };
                    };
                    rowFrameLayout.AddChidren(btnMember);
                    var btnDel = new Button()
                    {
                        Width = Application.GetRealWidth(184),
                        Text = Language.StringByID(R.MyInternationalizationString.DelBindDevice),
                        TextColor = Shared.Common.ZigbeeColor.Current.XMWhite,
                        TextSize = 12,
                        TextAlignment = TextAlignment.Center,
                        BackgroundColor = Shared.Common.ZigbeeColor.Current.XMDel,
                    };
                    rowFrameLayout.AddRightView(btnDel);
                    #endregion
                    #region 数据处理
@@ -445,7 +567,7 @@
                    switch (curDoorLockUser.UnlockType)
                    {
                        case 0:
                            if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null)
                            if (!string.IsNullOrEmpty(curDoorLockUser.UserName))
                            {
                                btnDoorlockUser.Text = curDoorLockUser.UserName;
                            }
@@ -455,7 +577,7 @@
                            }
                            break;
                        case 3:
                            if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null)
                            if (!string.IsNullOrEmpty(curDoorLockUser.UserName))
                            {
                                btnDoorlockUser.Text = curDoorLockUser.UserName;
                            }
@@ -465,7 +587,7 @@
                            }
                            break;
                        case 15:
                            if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null)
                            if (!string.IsNullOrEmpty(curDoorLockUser.UserName))
                            {
                                btnDoorlockUser.Text = curDoorLockUser.UserName;
                            }
@@ -476,21 +598,14 @@
                            break;
                    }
                    if (curAccountObj.UserName == "" || curAccountObj.UserName == null)
                    {
                        btnMember.Text = curAccountObj.Account;
                    }
                    else
                    {
                        btnMember.Text = curAccountObj.UserName;
                    }
                    Action<Shared.View> action = async (obj) =>
                     {
                         var refreshDoorLockData = new ZigBee.Device.DoorLock.RefreshDoorLockData();
                         if (UserCenterResourse.UserInfo.AuthorityNo != 1)
                         if (HdlUserCenterResourse.ResidenceOption.AuthorityNo != 1)
                         {
                             refreshDoorLockData.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
                             //☆マーク☆
                             //refreshDoorLockData.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
                             refreshDoorLockData.IsOtherAccountCtrl = true;
                         }
                         if (doorLock.DeviceAddr != null)
@@ -504,7 +619,7 @@
                         var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/UpdateDoorLock", refreshDoorLockData);
                         if (result != null)
                         {
                             if (result.StateCode == "Success")
                             if (result.Code == HttpMessageEnum.A成功)
                             {
                                 if (doorLock.localDoorLockUserList.ContainsKey(curDoorLockUser.UserID))
                                 {
@@ -512,9 +627,11 @@
                                     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;
                                     //☆マーク☆
                                     //localDoorLockObj.ConnectedAccount = curAccountObj.SubAccountDistributedMark;
                                     doorLock.localDoorLockUserList.Add(curDoorLockUser.UserID, localDoorLockObj);
                                     TypeRefresh();
                                 }
@@ -530,159 +647,18 @@
                         }
                     };
                    btnDoorlockUser.EditorEnterAction += action;
                    btnDel.MouseUpEventHandler += (sender, e) =>
                    {
                        var alert = new Alert(Language.StringByID(R.MyInternationalizationString.Tip), Language.StringByID(R.MyInternationalizationString.SureToDelUnlockMethod),
                                                      Language.StringByID(R.MyInternationalizationString.Cancel), Language.StringByID(R.MyInternationalizationString.Confrim));
                        alert.Show();
                        alert.ResultEventHandler += async (sender1, e1) =>
                        {
                            if (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);
                                    }
                                }
                                catch { }
                                finally
                                {
                                    CommonPage.Loading.Hide();
                                }
                            }
                        };
                    };
                    #endregion
                    i++;
                }
                //遮挡RowLayout多余的线条
                for (int j = 0; j < curAccountDoorLockUserList.Keys.Count; j++)
                {
                    var frameLayoutRowLineHide = new FrameLayout()
                    {
                        Height = 10,
                        Width = Application.GetRealWidth(173),
                        X = Application.GetRealWidth(58),
                        Y = (j + 1) * Application.GetRealHeight(145),
                        BackgroundColor = Shared.Common.ZigbeeColor.Current.XMWhite,
                    };
                    frameLayoutRow.AddChidren(frameLayoutRowLineHide);
                }
                frameLayoutRow.Height = i * Application.GetRealHeight(150);
            }
        }
        // 侧边导航栏
        /// <summary>
        /// 侧边导航栏
        /// </summary>
        void SideslipFramelayout()
        {
            #region sidelipFrameLayout UI
            var dialog = new Dialog
            {
            };
@@ -711,10 +687,13 @@
                Y = Application.GetRealHeight(28),
            };
            sidelipFrameLayout.AddChidren(sidelipVerticalScrolViewLayout);
            #endregion
            Button oldbutton = null;
            Button oldbuttonText = null;
            for (var i = 0; i < 4; i++)
            {
                #region rowFrameLayout UI
                var rowFrameLayout = new RowLayout()
                {
                    Height = Application.GetRealHeight(150),
@@ -727,7 +706,7 @@
                {
                    Width = Application.GetRealWidth(81),
                    Height = Application.GetRealHeight(81),
                    Y = Application.GetRealHeight(55),
                    Y = Application.GetRealHeight(35),
                };
                rowFrameLayout.AddChidren(btnAllMethod);
@@ -736,13 +715,15 @@
                    Width = Application.GetRealWidth(311),
                    Height = Application.GetRealHeight(58),
                    X = Application.GetRealWidth(92),
                    Y = Application.GetRealHeight(69),
                    Y = Application.GetRealHeight(49),
                    TextColor = Shared.Common.ZigbeeColor.Current.XMGray3,
                    TextSize = 14,
                    TextAlignment = TextAlignment.CenterLeft,
                };
                rowFrameLayout.AddChidren(btnMethodText);
                #endregion
                #region 数据处理
                EventHandler<MouseEventArgs> hander = (sender, e) =>
                {
                    if (!btnAllMethod.IsSelected)
@@ -761,6 +742,7 @@
                        doorLock.ReSave();
                        btnAllMethod.IsSelected = true;
                        oldbuttonText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack;
                        oldbuttonText.IsBold = true;
                        TypeRefresh();
                    }
                    dialog.Close();
@@ -769,69 +751,35 @@
                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;
                }
                DisplayAllUnlockMethod(i, btnAllMethod, btnMethodText);
                if (doorLock.currentUserDisplayMethod == "" && i == 0)
                if (string.IsNullOrEmpty(doorLock.currentUserDisplayMethod) && i == 0)
                {
                    btnAllMethod.IsSelected = true;
                    btnMethodText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack;
                    oldbutton = btnAllMethod;
                    oldbuttonText = btnMethodText;
                    CurrentSelectUnlockMethod(btnAllMethod, btnMethodText, oldbutton, oldbuttonText);
                }
                if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.AllMethod) && i == 0)
                {
                    btnAllMethod.IsSelected = true;
                    btnMethodText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack;
                    oldbutton = btnAllMethod;
                    oldbuttonText = btnMethodText;
                    CurrentSelectUnlockMethod(btnAllMethod, btnMethodText, oldbutton, oldbuttonText);
                }
                if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.PasswordUnlock) && i == 1)
                {
                    btnAllMethod.IsSelected = true;
                    btnMethodText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack;
                    oldbutton = btnAllMethod;
                    oldbuttonText = btnMethodText;
                    CurrentSelectUnlockMethod(btnAllMethod, btnMethodText, oldbutton, oldbuttonText);
                }
                if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.FingerprintUnlock) && i == 2)
                {
                    btnAllMethod.IsSelected = true;
                    btnMethodText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack;
                    oldbutton = btnAllMethod;
                    oldbuttonText = btnMethodText;
                    CurrentSelectUnlockMethod(btnAllMethod, btnMethodText, oldbutton, oldbuttonText);
                }
                if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.ProximithCardUnlock) && i == 3)
                {
                    btnAllMethod.IsSelected = true;
                    btnMethodText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack;
                    oldbutton = btnAllMethod;
                    oldbuttonText = btnMethodText;
                    CurrentSelectUnlockMethod(btnAllMethod, btnMethodText, oldbutton, oldbuttonText);
                }
                #endregion
            }
        }
        //类型区分
        /// <summary>
        /// 类型区分
        /// </summary>
        void TypeRefresh()
        {
            if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.PasswordUnlock))
@@ -857,19 +805,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)
        {
        }
    }
}