黄学彪
2020-12-17 9f326f4000847e6167d8166fa2f6a66f53cb3734
ZigbeeApp/Shared/Phone/UserCenter/DoorLock/EntryStatusPage.cs
@@ -8,12 +8,15 @@
namespace Shared.Phone.UserCenter.DoorLock
{
    public class EntryStatusPage : DoorLockCommonLayout, ZigBee.Common.IStatus
    public class EntryStatusPage : DoorLockCommonLayout
    {
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="doorLock"></param>
        public EntryStatusPage(ZigBee.Device.DoorLock doorLock, Shared.Phone.UserCenter.MemberInfoRes accountObj, string entryType)
        /// <param name="accountObj"></param>
        /// <param name="entryType"></param>
        public EntryStatusPage(ZigBee.Device.DoorLock doorLock, MemberInfoRes accountObj, string entryType)
        {
            this.doorLock = doorLock;
            this.curAccountObj = accountObj;
@@ -21,15 +24,27 @@
            BackgroundColor = Shared.Common.ZigbeeColor.Current.GXCTopViewBackgroundColor;
        }
        #region ◆ 变量申明__________________________
        #region 变量申明
        /// <summary>
        /// 当前门锁
        /// </summary>
        ZigBee.Device.DoorLock doorLock;
        Shared.Phone.UserCenter.MemberInfoRes curAccountObj;
        /// <summary>
        /// 当前账户
        /// </summary>
        MemberInfoRes curAccountObj;
        /// <summary>
        /// 当前类型
        /// </summary>
        string currentType = string.Empty;
        /// <summary>
        /// 底部布局
        /// </summary>
        FrameLayout bottomFrameLayout;
        #endregion
        /// <summary>
        /// UI显示
        /// <summary>
        /// UI显示
        /// </summary>
        public void Show()
        {
@@ -45,7 +60,9 @@
            MidFrameLayoutContent();
        }
        /// <summary>
        /// 中部布局
        /// </summary>
        public void MidFrameLayoutContent()
        {
            var entryStatusPic = new Button
@@ -85,7 +102,9 @@
            BottomFrameLayoutContent();
        }
        /// <summary>
        /// 底部布局
        /// </summary>
        public void BottomFrameLayoutContent()
        {
            bottomFrameLayout = new FrameLayout()
@@ -214,14 +233,7 @@
                btnPasswordRemarkContent.PlaceholderText = Language.StringByID(R.MyInternationalizationString.IcCard) + "ID" + doorLock.doorLockProgrammingEventNotificationCommand.UserID;
            }
            if (!string.IsNullOrEmpty(curAccountObj.UserName))
            {
                btnMatchPersonContent.Text = curAccountObj.UserName;
            }
            else
            {
                btnMatchPersonContent.Text = curAccountObj.Account;
            }
            btnMatchPersonContent.Text = curAccountObj.ShowName;
            completeBtn.MouseDownEventHandler += async (sender, e) =>
             {
@@ -231,13 +243,15 @@
                     return;
                 }
                 var addLockInfo = new ZigBee.Device.DoorLock.AddDoorLockData();
                 if (UserCenterResourse.UserInfo.AuthorityNo != 1)
                 if (HdlUserCenterResourse.ResidenceOption.AuthorityNo != 1)
                 {
                     addLockInfo.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
                     //☆マーク☆
                     //addLockInfo.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
                     addLockInfo.IsOtherAccountCtrl = true;
                 }
                 addLockInfo.CloudAccountId = curAccountObj.SubAccountDistributedMark;
                 //☆マーク☆
                 //addLockInfo.CloudAccountId = curAccountObj.SubAccountDistributedMark;
                 if (doorLock.DeviceAddr != null)
                 {
                     addLockInfo.DoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint;
@@ -259,49 +273,50 @@
                     var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/AddDoorLock", addLockInfo);
                     if (result != null)
                     {
                         if (result.StateCode == "Success")
                         if (result.Code == HttpMessageEnum.A成功)
                         {
                             if (doorLock.localDoorLockUserList.ContainsKey(doorLock.doorLockProgrammingEventNotificationCommand.UserID))
                             {
                                 //☆マーク☆
                                 //存门锁信息
                                 var resultList = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetCloudLocalDoorLocklist(doorLock, curAccountObj.SubAccountDistributedMark);
                                 if (resultList != null)
                                 {
                                     if (resultList.ContainsKey(doorLock.doorLockProgrammingEventNotificationCommand.UserID) == true)
                                     {
                                         var a = resultList[doorLock.doorLockProgrammingEventNotificationCommand.UserID];
                                         if (a?.ConnectedAccount == curAccountObj.SubAccountDistributedMark)
                                         {
                                             completeBtn.Enable = true;
                                             this.RemoveFromParent();
                                             for (int i = UserView.HomePage.Instance.ChildrenCount - 1; i >= 0; i--)
                                             {
                                                 var form = UserView.HomePage.Instance.GetChildren(i);
                                 //var resultList = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetCloudLocalDoorLocklist(doorLock, curAccountObj.SubAccountDistributedMark);
                                 //if (resultList != null)
                                 //{
                                 //    if (resultList.ContainsKey(doorLock.doorLockProgrammingEventNotificationCommand.UserID) == true)
                                 //    {
                                 //        var a = resultList[doorLock.doorLockProgrammingEventNotificationCommand.UserID];
                                 //        if (a?.ConnectedAccount == curAccountObj.SubAccountDistributedMark)
                                 //        {
                                 //            completeBtn.Enable = true;
                                 //            this.RemoveFromParent();
                                 //            for (int i = UserView.HomePage.Instance.ChildrenCount - 1; i >= 0; i--)
                                 //            {
                                 //                var form = UserView.HomePage.Instance.GetChildren(i);
                                                 if (form is UnLockMethod)
                                                 {
                                                     doorLock.currentUserDisplayMethod = "";
                                                     ((UnLockMethod)form).RefreshList();
                                                     break;
                                                 }
                                                 else
                                                 {
                                                     form.RemoveFromParent();
                                                 }
                                             }
                                         }
                                         else
                                         {
                                             completeBtn.Enable = true;
                                             new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.CloudServerResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnPasswordRemarkContent);
                                         }
                                     }
                                 }
                                 else
                                 {
                                     completeBtn.Enable = true;
                                     new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.CloudServerResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnPasswordRemarkContent);
                                 }
                                 //                if (form is UnLockMethod)
                                 //                {
                                 //                    doorLock.currentUserDisplayMethod = "";
                                 //                    ((UnLockMethod)form).RefreshList();
                                 //                    break;
                                 //                }
                                 //                else
                                 //                {
                                 //                    form.RemoveFromParent();
                                 //                }
                                 //            }
                                 //        }
                                 //        else
                                 //        {
                                 //            completeBtn.Enable = true;
                                 //            new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.CloudServerResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnPasswordRemarkContent);
                                 //        }
                                 //    }
                                 //}
                                 //else
                                 //{
                                 //    completeBtn.Enable = true;
                                 //    new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.CloudServerResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnPasswordRemarkContent);
                                 //}
                             }
                         }
@@ -324,172 +339,5 @@
                 }
             };
        }
        public void MatchUsersFrameLayout()
        {
            var flMain = new FrameLayout { BackgroundColor = 0x0f000000 };
            this.midFrameLayout.AddChidren(flMain);
            flMain.MouseUpEventHandler += (sender11, e11) =>
            {
                flMain.RemoveFromParent();
                bottomFrameLayout.RemoveAll();
                BottomFrameLayoutContent();
            };
            bottomFrameLayout = new FrameLayout()
            {
                Height = Application.GetRealHeight(100),
                Y = Application.GetRealHeight(930),
                Radius = 17,
                BackgroundColor = ZigbeeColor.Current.XMWhite,
            };
            flMain.AddChidren(bottomFrameLayout);
            var bottomFrameLayout1 = new FrameLayout()
            {
                Height = Application.GetRealHeight(806 - 50),
                Y = Application.GetRealHeight(930 + 48),
                BackgroundColor = ZigbeeColor.Current.XMWhite,
            };
            flMain.AddChidren(bottomFrameLayout1);
            var bottomFrameLayout2 = new FrameLayout()
            {
                Height = Application.GetRealHeight(806),
                Y = Application.GetRealHeight(930),
            };
            flMain.AddChidren(bottomFrameLayout2);
            var matchUsersFrameLayout = new FrameLayout()
            {
                Height = Application.GetRealHeight(138),
            };
            bottomFrameLayout2.AddChidren(matchUsersFrameLayout);
            var btnCancel = new Button
            {
                X = Application.GetRealWidth(81),
                Y = Application.GetRealHeight(40),
                Height = Application.GetRealHeight(58),
                Width = Application.GetRealWidth(101),
                Text = Language.StringByID(R.MyInternationalizationString.Cancel),
                TextColor = Shared.Common.ZigbeeColor.Current.XMGray3,
                TextSize = 14,
            };
            matchUsersFrameLayout.AddChidren(btnCancel);
            var btnMatchUser = new Button
            {
                X = Application.GetRealWidth(446),
                Y = Application.GetRealHeight(35),
                Height = Application.GetRealHeight(63),
                Width = Application.GetRealWidth(284),
                Text = Language.StringByID(R.MyInternationalizationString.MatchPerson),
                TextColor = Shared.Common.ZigbeeColor.Current.XMBlack,
                TextSize = 16,
            };
            matchUsersFrameLayout.AddChidren(btnMatchUser);
            var btnFinish = new Button
            {
                X = Application.GetRealWidth(919),
                Y = Application.GetRealHeight(40),
                Height = Application.GetRealHeight(58),
                Width = Application.GetRealWidth(101),
                Text = Language.StringByID(R.MyInternationalizationString.Complete),
                TextColor = Shared.Common.ZigbeeColor.Current.XMGray3,
                TextSize = 14,
            };
            matchUsersFrameLayout.AddChidren(btnFinish);
            var btnTopLine = new FrameLayout()
            {
                Height = Application.GetRealHeight(5),
                Y = Application.GetRealHeight(138),
                BackgroundColor = Shared.Common.ZigbeeColor.Current.XMGray3,
            };
            bottomFrameLayout2.AddChidren(btnTopLine);
            var matchUserHorizontalScrolViewLayout = new VerticalScrolViewLayout()
            {
                Y = Application.GetRealHeight(207),
                Height = Application.GetRealHeight(806 - 207),
            };
            bottomFrameLayout2.AddChidren(matchUserHorizontalScrolViewLayout);
            for (var i = 0; i < 4; i++)
            {
                var rowFrameLayout = new FrameLayout()
                {
                    Height = Application.GetRealHeight(127),
                };
                matchUserHorizontalScrolViewLayout.AddChidren(rowFrameLayout);
                var btnUserName = new Button()
                {
                    Width = Application.GetRealWidth(743),
                    Height = Application.GetRealHeight(58),
                    X = Application.GetRealWidth(81),
                    Y = Application.GetRealHeight(37),
                    TextColor = Shared.Common.ZigbeeColor.Current.XMGray3,
                    TextSize = 14,
                    TextAlignment = TextAlignment.CenterLeft,
                };
                rowFrameLayout.AddChidren(btnUserName);
                var btnChoose = new Button()
                {
                    Width = Application.GetRealWidth(58),
                    Height = Application.GetRealHeight(58),
                    X = Application.GetRealWidth(861 + 81),
                    Y = Application.GetRealHeight(35),
                    BackgroundColor = ZigbeeColor.Current.XMOrange,
                };
                rowFrameLayout.AddChidren(btnChoose);
                var btnLine = new FrameLayout()
                {
                    Width = Application.GetRealWidth(919),
                    Height = Application.GetRealHeight(5),
                    X = Application.GetRealWidth(81),
                    Y = Application.GetRealHeight(122),
                    BackgroundColor = Shared.Common.ZigbeeColor.Current.XMGray3,
                };
                rowFrameLayout.AddChidren(btnLine);
            }
        }
        #region ◆ 接口实现__________________________
        /// <summary>
        /// 处理变化事件 --将弃用 改用DeviceInfoChange()
        /// </summary>
        /// <returns>The changed.</returns>
        /// <param name="common">Common.</param>
        public void Changed(CommonDevice common)
        {
        }
        /// <summary>
        /// 处理变化事件
        /// </summary>
        /// <param name="common"></param>
        /// <param name="typeTag"></param>
        public void DeviceInfoChange(CommonDevice common, string typeTag)
        {
        }
        /// <summary>
        /// Changeds the IL ogic status.
        /// </summary>
        /// <param name="logic">Logic.</param>
        public void ChangedILogicStatus(ZigBee.Device.Logic logic)
        {
        }
        /// <summary>
        /// Changeds the IS cene status.
        /// </summary>
        /// <param name="scene">Scene.</param>
        public void ChangedISceneStatus(Scene scene)
        {
        }
        #endregion
    }
}