using System; using ZigBee.Device; namespace Shared.Phone.UserCenter.DoorLock { public class MasterManagementPage : DoorLockCommonLayout, ZigBee.Common.IStatus { /// /// 构造函数 /// /// public MasterManagementPage(ZigBee.Device.DoorLock doorLock, Shared.Phone.UserCenter.MemberInfoRes accountObj) { this.doorLock = doorLock; this.accountObj = accountObj; BackgroundColor = Shared.Common.ZigbeeColor.Current.GXCTopViewBackgroundColor; } #region ◆ 变量申明__________________________ ZigBee.Device.DoorLock doorLock; Shared.Phone.UserCenter.MemberInfoRes accountObj; #endregion void ReadDoorLockUserInfo() { System.Threading.Tasks.Task.Run(async () => { Application.RunOnMainThread(() => { CommonPage.Loading.Start("Loading..."); }); try { CommonDevice.DebugPrintLog($"11111111111111F"); await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetLocaDoorLocklist(doorLock, accountObj); CommonDevice.DebugPrintLog($"11111111111111G"); } catch { } finally { Application.RunOnMainThread(() => { MidFrameLayoutContent(); CommonDevice.DebugPrintLog($"11111111111111E"); CommonPage.Loading.Hide(); }); } }); } /// /// UI显示 /// public void Show() { CommonDevice.DebugPrintLog($"11111111111111A"); this.TopFrameLayout(this, accountObj.Account); EventHandler eHandlerBack = (sender, e) => { RemoveFromParent(); }; this.btnBack.MouseUpEventHandler += eHandlerBack; this.btnBackFrameLayout.MouseUpEventHandler += eHandlerBack; this.MidFrameLayout(this); CommonDevice.DebugPrintLog($"11111111111111B"); ReadDoorLockUserInfo(); CommonDevice.DebugPrintLog($"11111111111111C"); } public void MidFrameLayoutContent() { CommonDevice.DebugPrintLog($"11111111111111D"); var bodyView = new VerticalScrolViewLayout() { }; this.midFrameLayout.AddChidren(bodyView); for (int i = 0; i < 2; i++) { var RowView = new FrameLayout() { Height = Application.GetRealHeight(161), }; bodyView.AddChidren(RowView); var btnMemberName = new Button() { X = Application.GetRealWidth(58), Y = Application.GetRealHeight(58), Width = Application.GetRealWidth(743), Height = Application.GetRealHeight(58), TextColor = Shared.Common.ZigbeeColor.Current.XMBlack, TextAlignment = TextAlignment.CenterLeft, TextSize = 14, }; RowView.AddChidren(btnMemberName); var btnRight = new Button() { X = Application.GetRealWidth(58 + 899), Y = Application.GetRealHeight(58), Height = Application.GetRealHeight(58), Width = Application.GetRealWidth(58), UnSelectedImagePath = "Item/Next.png", SelectedImagePath = "Item/Down.png", }; RowView.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); int currentIndex = i; if (i == 0) { btnMemberName.Text = Language.StringByID(R.MyInternationalizationString.LockMethod); } else { btnMemberName.Text = Language.StringByID(R.MyInternationalizationString.LinkageEvent); } EventHandler eHandler = (sender, e) => { if (currentIndex == 0) { var unLockMethod = new Shared.Phone.UserCenter.DoorLock.UnLockMethod(doorLock, accountObj); Shared.Phone.UserView.HomePage.Instance.AddChidren(unLockMethod); Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; unLockMethod.Show(); } else { } }; btnRight.MouseUpEventHandler += eHandler; RowView.MouseUpEventHandler += eHandler; } } #region ◆ 接口实现__________________________ /// /// 处理变化事件 --将弃用 改用DeviceInfoChange() /// /// The changed. /// Common. public void Changed(CommonDevice common) { } /// /// 处理变化事件 /// /// /// public void DeviceInfoChange(CommonDevice common, string typeTag) { } /// /// Changeds the IL ogic status. /// /// Logic. public void ChangedILogicStatus(ZigBee.Device.Logic logic) { } /// /// Changeds the IS cene status. /// /// Scene. public void ChangedISceneStatus(Scene scene) { } #endregion } }