From a4924de3136289d10cabbf2f61a228387d44ded7 Mon Sep 17 00:00:00 2001 From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local> Date: 星期四, 07 十一月 2019 13:48:36 +0800 Subject: [PATCH] Merge branch 'dev-tzy' into DEV_GXC --- ZigbeeApp/Shared/Phone/UserCenter/DoorLock/EntryStatusPage.cs | 92 ++++++++++++++++++++++++++++++---------------- 1 files changed, 60 insertions(+), 32 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/EntryStatusPage.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/EntryStatusPage.cs index ed813a1..54e6830 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/EntryStatusPage.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/EntryStatusPage.cs @@ -26,7 +26,6 @@ Shared.Phone.UserCenter.MemberInfoRes curAccountObj; string currentType = string.Empty; FrameLayout bottomFrameLayout; - #endregion /// <summary> @@ -169,7 +168,6 @@ TextColor = Shared.Common.ZigbeeColor.Current.XMGray3, TextAlignment = TextAlignment.CenterLeft, TextSize = 14, - Text = curAccountObj.UserName, }; personRemarkRemarkFrameLayout.AddChidren(btnMatchPersonContent); @@ -203,11 +201,25 @@ btnPasswordRemark.Text = Language.StringByID(R.MyInternationalizationString.ProximityRemark); btnPasswordRemarkContent.PlaceholderText = Language.StringByID(R.MyInternationalizationString.ProximityCard) + "-" + doorLock.doorLockProgrammingEventNotificationCommand.UserID; } + if (curAccountObj.UserName != "" && curAccountObj.UserName != null) + { + btnMatchPersonContent.Text = curAccountObj.UserName; + } + else + { + btnMatchPersonContent.Text = curAccountObj.Account; + } completeBtn.MouseDownEventHandler += async (sender, e) => { completeBtn.Enable = false; 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,8 +227,7 @@ } addLockInfo.OpenLockMode = doorLock.doorLockProgrammingEventNotificationCommand.ProgramEventSoure; addLockInfo.DoorLockLocalUserId = doorLock.doorLockProgrammingEventNotificationCommand.UserID.ToString(); - var entryTime = ZigBee.Device.DoorLock.GetLocalTime(doorLock.doorLockProgrammingEventNotificationCommand.ZigbeeLocalTime, false); - addLockInfo.EntryTime = entryTime; + addLockInfo.EntryTime = System.DateTime.Now; if (btnPasswordRemarkContent.Text != "") { addLockInfo.UserIdRemarks = btnPasswordRemarkContent.Text; @@ -227,47 +238,65 @@ } try { - var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("App/AddDoorLock", addLockInfo); - if (result.StateCode == "Success") + Application.RunOnMainThread(() => { CommonPage.Loading.Start("Loading..."); }); + var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/AddDoorLock", addLockInfo); + 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); + //瀛樿处鎴蜂俊鎭� + // var resultList1 = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetCloudLocalAccountlist(doorLock, curAccountObj.SubAccountDistributedMark); + //瀛橀棬閿佷俊鎭� + var resultList = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetCloudLocalDoorLocklist(doorLock, curAccountObj.SubAccountDistributedMark); + 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) - { - ((UnLockMethod)form).RefreshList(); - break; - } - else - { - form.RemoveFromParent(); + if (form is UnLockMethod) + { + ((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.ModigfyFailed), 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(); + } }; } @@ -376,7 +405,6 @@ Height = Application.GetRealHeight(58), X = Application.GetRealWidth(81), Y = Application.GetRealHeight(37), - Text = "Krafty", TextColor = Shared.Common.ZigbeeColor.Current.XMGray3, TextSize = 14, TextAlignment = TextAlignment.CenterLeft, -- Gitblit v1.8.0