using System; using ZigBee.Device; namespace Shared.Phone.UserCenter.DoorLock { public class AddUnLockMethod : DoorLockCommonLayout { /// 构造函数 /// /// public AddUnLockMethod(ZigBee.Device.DoorLock doorLock, Shared.Phone.UserCenter.MemberInfoRes accountObj) { this.doorLock = doorLock; this.curAccountObj = accountObj; BackgroundColor = Shared.Common.ZigbeeColor.Current.GXCTopViewBackgroundColor; } #region 变量申明 /// /// 当前门锁 /// ZigBee.Device.DoorLock doorLock; /// /// 当前账户 /// Shared.Phone.UserCenter.MemberInfoRes curAccountObj; #endregion /// /// UI显示 /// public void Show() { this.TopFrameLayout(this, Language.StringByID(R.MyInternationalizationString.AddNewUnlockMethod)); EventHandler eHandlerBack = (sender, e) => { RemoveFromParent(); }; this.btnBack.MouseUpEventHandler += eHandlerBack; this.btnBackFrameLayout.MouseUpEventHandler += eHandlerBack; this.MidFrameLayout(this); MidFrameLayoutContent(); } /// /// 中部布局 /// public void MidFrameLayoutContent() { var bodyView = new VerticalScrolViewLayout() { }; this.midFrameLayout.AddChidren(bodyView); int count = GetSupportType(doorLock); for (int i = 0; i < count; i++) { var RowView = new FrameLayout() { Height = Application.GetRealHeight(161), BackgroundColor = Shared.Common.ZigbeeColor.Current.XMWhite, }; bodyView.AddChidren(RowView); var btnText = new Button() { X = Application.GetRealWidth(58), Width = Application.GetRealWidth(300), Height = Application.GetRealHeight(300), TextAlignment = TextAlignment.CenterLeft, TextColor = Shared.Common.ZigbeeColor.Current.XMBlack, Gravity = Gravity.CenterVertical, TextSize = 14, }; RowView.AddChidren(btnText); var btnRightFrameLayout = new FrameLayout() { Height = Application.GetRealHeight(110), Width = Application.GetRealWidth(110), X = Application.CurrentWidth - Application.GetRealWidth(150), Y = Application.GetRealHeight(25), }; RowView.AddChidren(btnRightFrameLayout); var btnRight = new Button() { Height = Application.GetRealHeight(60), Width = Application.GetRealWidth(60), UnSelectedImagePath = "DoorLock/RightIcon.png", Gravity = Gravity.Center, }; btnRightFrameLayout.AddChidren(btnRight); var line2 = new Button() { Y = RowView.Height - 1, X = Application.GetRealWidth(58), Width = Application.GetRealWidth(965), Height = 1, BackgroundColor = Shared.Common.ZigbeeColor.Current.XMRowLine, }; RowView.AddChidren(line2); var listDevice = Common.LocalDevice.Current.GetDevicesByMac(doorLock.DeviceAddr); var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(listDevice); if (i == 0) { btnText.TextID = R.MyInternationalizationString.AddPassword; } else if (i == 1) { if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.IntelligentLocks_AT1F) { btnText.TextID = R.MyInternationalizationString.AddDoorLockCalmFingerprint; } else if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.IntelligentLocks_HAT1B) { btnText.TextID = R.MyInternationalizationString.AddDoorLockCalmFingerprint; } else { btnText.TextID = R.MyInternationalizationString.AddFingerprint; } } else if (i == 2) { if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.IntelligentLocks_AT1F) { btnText.TextID = R.MyInternationalizationString.AddDoorLockFaceID; } else if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.IntelligentLocks_AT1TF) { btnText.TextID = R.MyInternationalizationString.AddIcCard; } else { btnText.TextID = R.MyInternationalizationString.AddIcCard; } } if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.IntelligentLocks_AT1TF) { if (i == 3) { btnText.TextID = R.MyInternationalizationString.AddDoorLockFaceID; } } if (i == count - 1) { line2.Visible = false; } int currentIndex = i; EventHandler eHandler = (sender, e) => { string unlockTypeStr = ""; if (currentIndex == 0) { unlockTypeStr = "password"; } else if (currentIndex == 1) { unlockTypeStr = "fingerprint"; } else if (currentIndex == 2) { unlockTypeStr = "proximity"; } else if (currentIndex == 3) { unlockTypeStr = "faceID"; } else if (currentIndex == 4) { unlockTypeStr = "calmFingerprint"; } var addUnLockMethodTip = new AddUnLockMethodTip(doorLock, curAccountObj, unlockTypeStr); Shared.Phone.UserView.HomePage.Instance.AddChidren(addUnLockMethodTip); Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; addUnLockMethodTip.Show(); }; btnRight.MouseUpEventHandler += eHandler; RowView.MouseUpEventHandler += eHandler; btnText.MouseUpEventHandler += eHandler; } } } }