From 9a4b76398009cf76c508d61f7e48fb6f5cb7ac2d Mon Sep 17 00:00:00 2001 From: xm <1271024303@qq.com> Date: 星期二, 21 七月 2020 09:46:53 +0800 Subject: [PATCH] 请合并最新多功能面板代码 --- ZigbeeApp/Shared/Phone/UserCenter/DoorLock/EntryStatusPage.cs | 347 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 347 insertions(+), 0 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/EntryStatusPage.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/EntryStatusPage.cs new file mode 100755 index 0000000..aee5ff4 --- /dev/null +++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/EntryStatusPage.cs @@ -0,0 +1,347 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; +using Newtonsoft.Json; +using Shared.Common; +using Shared.Phone.UserCenter.Device; +using ZigBee.Device; + +namespace Shared.Phone.UserCenter.DoorLock +{ + public class EntryStatusPage : DoorLockCommonLayout + { + /// <summary> + /// 鏋勯�犲嚱鏁� + /// </summary> + /// <param name="doorLock"></param> + /// <param name="accountObj"></param> + /// <param name="entryType"></param> + public EntryStatusPage(ZigBee.Device.DoorLock doorLock, Shared.Phone.UserCenter.MemberInfoRes accountObj, string entryType) + { + this.doorLock = doorLock; + this.curAccountObj = accountObj; + this.currentType = entryType; + BackgroundColor = Shared.Common.ZigbeeColor.Current.GXCTopViewBackgroundColor; + } + + #region 鍙橀噺鐢虫槑 + /// <summary> + /// 褰撳墠闂ㄩ攣 + /// </summary> + ZigBee.Device.DoorLock doorLock; + /// <summary> + /// 褰撳墠璐︽埛 + /// </summary> + Shared.Phone.UserCenter.MemberInfoRes curAccountObj; + /// <summary> + /// 褰撳墠绫诲瀷 + /// </summary> + string currentType = string.Empty; + /// <summary> + /// 搴曢儴甯冨眬 + /// </summary> + FrameLayout bottomFrameLayout; + #endregion + + /// <summary> + /// UI鏄剧ず + /// </summary> + public void Show() + { + this.TopFrameLayout(this, Language.StringByID(R.MyInternationalizationString.AddNewUnlockMethod)); + + EventHandler<MouseEventArgs> eHandlerBack = (sender, e) => + { + RemoveFromParent(); + }; + this.btnBack.MouseUpEventHandler += eHandlerBack; + this.btnBackFrameLayout.MouseUpEventHandler += eHandlerBack; + this.MidFrameLayout(this); + + MidFrameLayoutContent(); + } + /// <summary> + /// 涓儴甯冨眬 + /// </summary> + public void MidFrameLayoutContent() + { + var entryStatusPic = new Button + { + X = Application.GetRealWidth(297), + Y = Application.GetRealHeight(268), + Height = Application.GetRealHeight(363), + Width = Application.GetRealWidth(452), + UnSelectedImagePath = "DoorLock/EntrySuccessIcon.png", + }; + this.midFrameLayout.AddChidren(entryStatusPic); + + var btnPicTip = new Button + { + X = Application.GetRealWidth(372), + Y = Application.GetRealHeight(634), + Height = Application.GetRealHeight(81), + TextColor = Shared.Common.ZigbeeColor.Current.XMBlack, + Gravity = Gravity.CenterHorizontal, + TextSize = 20, + IsBold = true, + }; + this.midFrameLayout.AddChidren(btnPicTip); + + if (currentType == "password") + { + btnPicTip.Text = Language.StringByID(R.MyInternationalizationString.EntryPasswordSuccess); + } + else if (currentType == "fingerprint") + { + btnPicTip.Text = Language.StringByID(R.MyInternationalizationString.EntryFingerprintSuccess); + } + else + { + btnPicTip.Text = Language.StringByID(R.MyInternationalizationString.EntryProximitySuccess); + } + + BottomFrameLayoutContent(); + } + /// <summary> + /// 搴曢儴甯冨眬 + /// </summary> + public void BottomFrameLayoutContent() + { + bottomFrameLayout = new FrameLayout() + { + Height = Application.GetRealHeight(737), + Y = Application.GetRealHeight(999), + BackgroundColor = ZigbeeColor.Current.XMWhite, + }; + this.midFrameLayout.AddChidren(bottomFrameLayout); + + var passwordRemarkFrameLayout = new FrameLayout() + { + Width = Application.GetRealWidth(965), + Height = Application.GetRealHeight(127), + X = Application.GetRealWidth(58), + Y = Application.GetRealHeight(81), + }; + bottomFrameLayout.AddChidren(passwordRemarkFrameLayout); + + var btnPasswordRemark = new Button() + { + Width = Application.GetRealWidth(222), + Height = Application.GetRealHeight(58), + Y = Application.GetRealHeight(35), + TextColor = Shared.Common.ZigbeeColor.Current.XMBlack, + TextAlignment = TextAlignment.CenterLeft, + TextSize = 14, + }; + passwordRemarkFrameLayout.AddChidren(btnPasswordRemark); + + var btnPasswordRemarkContent = new EditText() + { + Width = Application.GetRealWidth(965 - 222), + Height = Application.GetRealHeight(58), + X = Application.GetRealWidth(223), + Y = Application.GetRealHeight(35), + TextAlignment = TextAlignment.CenterLeft, + TextSize = 14, + PlaceholderTextColor = ZigbeeColor.Current.XMGray3, + TextColor = ZigbeeColor.Current.XMBlack + }; + passwordRemarkFrameLayout.AddChidren(btnPasswordRemarkContent); + + var btnLine = new FrameLayout() + { + Width = Application.GetRealWidth(965), + Height = 1, + X = Application.GetRealWidth(58), + Y = Application.GetRealHeight(81 + 127), + BackgroundColor = Shared.Common.ZigbeeColor.Current.XMRowLine, + }; + bottomFrameLayout.AddChidren(btnLine); + + var personRemarkRemarkFrameLayout = new FrameLayout() + { + Width = Application.GetRealWidth(965), + Height = Application.GetRealHeight(127), + X = Application.GetRealWidth(58), + Y = btnLine.Bottom + Application.GetRealHeight(2), + }; + bottomFrameLayout.AddChidren(personRemarkRemarkFrameLayout); + + var btnMatchPersonRemark = new Button() + { + Width = Application.GetRealWidth(222), + Height = Application.GetRealHeight(58), + Y = Application.GetRealHeight(35), + Text = Language.StringByID(R.MyInternationalizationString.MatchPerson) + ":", + TextColor = Shared.Common.ZigbeeColor.Current.XMBlack, + TextAlignment = TextAlignment.CenterLeft, + TextSize = 14, + }; + personRemarkRemarkFrameLayout.AddChidren(btnMatchPersonRemark); + + var btnMatchPersonContent = new Button() + { + Width = Application.GetRealWidth(965 - 222), + Height = Application.GetRealHeight(58), + X = Application.GetRealWidth(223), + Y = Application.GetRealHeight(35), + TextColor = Shared.Common.ZigbeeColor.Current.XMGray3, + TextAlignment = TextAlignment.CenterLeft, + TextSize = 14, + }; + 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 + { + X = Application.GetRealWidth(86), + Y = Application.GetRealHeight(472), + Height = Application.GetRealHeight(127), + Width = Application.GetRealWidth(907), + Text = Language.StringByID(R.MyInternationalizationString.DoorLockComplete), + TextColor = Shared.Common.ZigbeeColor.Current.XMWhite, + Gravity = Gravity.CenterHorizontal, + BackgroundColor = Shared.Common.ZigbeeColor.Current.XMBlack, + 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) + "ID" + doorLock.doorLockProgrammingEventNotificationCommand.UserID; + } + else if (currentType == "fingerprint") + { + btnPasswordRemark.Text = Language.StringByID(R.MyInternationalizationString.FingerprintRemark); + 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.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) + { + addLockInfo.DoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint; + } + addLockInfo.OpenLockMode = doorLock.doorLockProgrammingEventNotificationCommand.ProgramEventSoure; + addLockInfo.DoorLockLocalUserId = doorLock.doorLockProgrammingEventNotificationCommand.UserID.ToString(); + addLockInfo.EntryTime = System.DateTime.Now; + if (!string.IsNullOrEmpty(btnPasswordRemarkContent.Text)) + { + addLockInfo.UserIdRemarks = btnPasswordRemarkContent.Text; + } + else + { + addLockInfo.UserIdRemarks = btnPasswordRemarkContent.PlaceholderText; + } + try + { + Application.RunOnMainThread(() => { CommonPage.Loading.Start("Loading..."); }); + var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/AddDoorLock", addLockInfo); + if (result != null) + { + if (result.StateCode == "Success") + { + 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); + + 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); + } + + } + } + 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.CloudServerResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnPasswordRemarkContent); + } + } + catch { } + finally + { + CommonPage.Loading.Hide(); + } + }; + } + } +} -- Gitblit v1.8.0