gxc
2020-02-28 66a9965c44ecc32a6696abca876ab9d1cd091584
ZigbeeApp/Shared/Phone/UserCenter/DoorLock/EntryStatusPage.cs
@@ -26,7 +26,6 @@
        Shared.Phone.UserCenter.MemberInfoRes curAccountObj;
        string currentType = string.Empty;
        FrameLayout bottomFrameLayout;
        #endregion
        /// <summary>
@@ -67,6 +66,7 @@
                TextColor = Shared.Common.ZigbeeColor.Current.XMBlack,
                Gravity = Gravity.CenterHorizontal,
                TextSize = 20,
                IsBold = true,
            };
            this.midFrameLayout.AddChidren(btnPicTip);
@@ -132,7 +132,7 @@
            var btnLine = new FrameLayout()
            {
                Width = Application.GetRealWidth(965),
                Height = Application.GetRealHeight(5),
                Height = 1,
                X = Application.GetRealWidth(58),
                Y = Application.GetRealHeight(81 + 127),
                BackgroundColor = Shared.Common.ZigbeeColor.Current.XMRowLine,
@@ -153,7 +153,7 @@
                Width = Application.GetRealWidth(222),
                Height = Application.GetRealHeight(58),
                Y = Application.GetRealHeight(35),
                Text = Language.StringByID(R.MyInternationalizationString.MatchPerson),
                Text = Language.StringByID(R.MyInternationalizationString.MatchPerson) + ":",
                TextColor = Shared.Common.ZigbeeColor.Current.XMBlack,
                TextAlignment = TextAlignment.CenterLeft,
                TextSize = 14,
@@ -169,9 +169,18 @@
                TextColor = Shared.Common.ZigbeeColor.Current.XMGray3,
                TextAlignment = TextAlignment.CenterLeft,
                TextSize = 14,
                Text = curAccountObj.UserName,
            };
            personRemarkRemarkFrameLayout.AddChidren(btnMatchPersonContent);
            var btnLine1 = new FrameLayout()
            {
                Width = Application.GetRealWidth(965),
                Height = 1,
                X = Application.GetRealWidth(58),
                Y = Application.GetRealHeight(81 + 127 + 12 + 127),
                BackgroundColor = Shared.Common.ZigbeeColor.Current.XMRowLine,
            };
            bottomFrameLayout.AddChidren(btnLine1);
            var completeBtn = new Button
            {
@@ -183,31 +192,51 @@
                TextColor = Shared.Common.ZigbeeColor.Current.XMWhite,
                Gravity = Gravity.CenterHorizontal,
                BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack,
                Radius = 10,
                Radius = (uint)Application.GetRealHeight(127 / 2),
                TextSize = 16,
                IsBold = true,
            };
            bottomFrameLayout.AddChidren(completeBtn);
            if (currentType == "password")
            {
                btnPasswordRemark.Text = Language.StringByID(R.MyInternationalizationString.PasswordRemark);
                btnPasswordRemarkContent.PlaceholderText = Language.StringByID(R.MyInternationalizationString.Password) + "-" + doorLock.doorLockProgrammingEventNotificationCommand.UserID;
                btnPasswordRemarkContent.PlaceholderText = Language.StringByID(R.MyInternationalizationString.Password) + "ID" + doorLock.doorLockProgrammingEventNotificationCommand.UserID;
            }
            else if (currentType == "fingerprint")
            {
                btnPasswordRemark.Text = Language.StringByID(R.MyInternationalizationString.FingerprintRemark);
                btnPasswordRemarkContent.PlaceholderText = Language.StringByID(R.MyInternationalizationString.Fingerprint) + "-" + doorLock.doorLockProgrammingEventNotificationCommand.UserID;
                btnPasswordRemarkContent.PlaceholderText = Language.StringByID(R.MyInternationalizationString.Fingerprint) + "ID" + doorLock.doorLockProgrammingEventNotificationCommand.UserID;
            }
            else
            {
                btnPasswordRemark.Text = Language.StringByID(R.MyInternationalizationString.ProximityRemark);
                btnPasswordRemarkContent.PlaceholderText = Language.StringByID(R.MyInternationalizationString.ProximityCard) + "-" + doorLock.doorLockProgrammingEventNotificationCommand.UserID;
                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;
            }
            completeBtn.MouseDownEventHandler += async (sender, e) =>
             {
                 completeBtn.Enable = false;
                 if (doorLock.doorLockProgrammingEventNotificationCommand == null)
                 {
                     return;
                 }
                 var addLockInfo = new ZigBee.Device.DoorLock.AddDoorLockData();
                 if (UserCenterResourse.UserInfo.AuthorityNo != 1)
                 {
                     addLockInfo.LoginAccessToken = UserCenterLogic.GetConnectMainToken();
                     addLockInfo.IsOtherAccountCtrl = true;
                 }
                 addLockInfo.CloudAccountId = curAccountObj.SubAccountDistributedMark;
                 if (doorLock.DeviceAddr != null)
                 {
@@ -215,9 +244,8 @@
                 }
                 addLockInfo.OpenLockMode = doorLock.doorLockProgrammingEventNotificationCommand.ProgramEventSoure;
                 addLockInfo.DoorLockLocalUserId = doorLock.doorLockProgrammingEventNotificationCommand.UserID.ToString();
                 //var entryTime = Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetLocalTime(doorLock.doorLockProgrammingEventNotificationCommand.ZigbeeLocalTime);
                 addLockInfo.EntryTime = System.DateTime.Now;
                 if (btnPasswordRemarkContent.Text != "")
                 if (!string.IsNullOrEmpty(btnPasswordRemarkContent.Text))
                 {
                     addLockInfo.UserIdRemarks = btnPasswordRemarkContent.Text;
                 }
@@ -227,47 +255,73 @@
                 }
                 try
                 {
                     Application.RunOnMainThread(() => { CommonPage.Loading.Start("Loading..."); });
                     var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/AddDoorLock", addLockInfo);
                     if (result != null && result.StateCode == "Success")
                     if (result != null)
                     {
                         if (doorLock.localDoorLockUserList.ContainsKey(doorLock.doorLockProgrammingEventNotificationCommand.UserID))
                         if (result.StateCode == "Success")
                         {
                             doorLock.localDoorLockUserList.Remove(doorLock.doorLockProgrammingEventNotificationCommand.UserID);
                             var localDoorLockObj = new ZigBee.Device.DoorLock.LocaDoorLockObj() { };
                             localDoorLockObj.UserID = doorLock.doorLockProgrammingEventNotificationCommand.UserID;
                             localDoorLockObj.UnlockType = addLockInfo.OpenLockMode;
                             localDoorLockObj.EntryTime = addLockInfo.EntryTime;
                             localDoorLockObj.UserName = addLockInfo.UserIdRemarks;
                             localDoorLockObj.ConnectedAccount = curAccountObj.SubAccountDistributedMark;
                             doorLock.localDoorLockUserList.Add(doorLock.doorLockProgrammingEventNotificationCommand.UserID, localDoorLockObj);
                             completeBtn.Enable = true;
                             this.RemoveFromParent();
                             for (int i = UserView.HomePage.Instance.ChildrenCount - 1; i >= 0; i--)
                             if (doorLock.localDoorLockUserList.ContainsKey(doorLock.doorLockProgrammingEventNotificationCommand.UserID))
                             {
                                 var form = UserView.HomePage.Instance.GetChildren(i);
                                 if (form is UnLockMethod)
                                 //存门锁信息
                                 var resultList = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetCloudLocalDoorLocklist(doorLock, curAccountObj.SubAccountDistributedMark);
                                 if (resultList != null)
                                 {
                                     ((UnLockMethod)form).RefreshList();
                                     break;
                                     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
                                 {
                                     form.RemoveFromParent();
                                     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.AddFailed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnPasswordRemarkContent);
                         }
                     }
                     else
                     {
                         completeBtn.Enable = true;
                         new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.ModigfyFailed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnPasswordRemarkContent);
                         new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.CloudServerResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnPasswordRemarkContent);
                     }
                 }
                 catch { }
                 finally
                 {
                     CommonPage.Loading.Hide();
                 }
             };
        }