| | |
| | | public UserManagement(ZigBee.Device.DoorLock doorLock) |
| | | { |
| | | this.doorLock = doorLock; |
| | | localAllAccountListTemp = doorLock.localAllAccountList; |
| | | localDoorLockUserListTemp = doorLock.localDoorLockUserList; |
| | | } |
| | | |
| | | #region ◆ 变量申明__________________________ |
| | | ZigBee.Device.DoorLock doorLock; |
| | | VerticalScrolViewLayout midVerticalScrolViewLayout; |
| | | VerticalRefreshLayout midVerticalScrolViewLayout; |
| | | public List<Shared.Phone.UserCenter.MemberInfoRes> localAllAccountListTemp = new List<Shared.Phone.UserCenter.MemberInfoRes> { }; |
| | | public Dictionary<int, DoorLockCommonInfo.LocaDoorLockObj> localDoorLockUserListTemp = new Dictionary<int, DoorLockCommonInfo.LocaDoorLockObj>(); |
| | | |
| | | |
| | | #endregion |
| | | |
| | | void ReadAccountList() |
| | | /// <summary> |
| | | /// 数据刷新 |
| | | /// </summary> |
| | | void ReadAccountDoorLockInfoList() |
| | | { |
| | | System.Threading.Tasks.Task.Run(async () => |
| | | { |
| | | Application.RunOnMainThread(() => { CommonPage.Loading.Start("Loading..."); }); |
| | | try |
| | | { |
| | | var localAccountListTemp = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.LocalAccountList(); |
| | |
| | | { |
| | | doorLock.localAllAccountList.Clear(); |
| | | doorLock.localAllAccountList = localAccountListTemp; |
| | | localAllAccountListTemp = doorLock.localAllAccountList; |
| | | |
| | | //初始化权限信息 |
| | | foreach (var sub in localAccountListTemp) |
| | | { |
| | | //初始化权限信息 |
| | | if (doorLock.IsFreezeAccount.ContainsKey(sub.SubAccountDistributedMark) == false) |
| | | { |
| | | doorLock.IsFreezeAccount.Add(sub.SubAccountDistributedMark, false); |
| | |
| | | doorLock.IsFailedToGetDoorLockInfo.Add(sub.SubAccountDistributedMark, false); |
| | | } |
| | | } |
| | | |
| | | //获取本地门锁列表 |
| | | if (localDoorLockUserListTemp.Count == 0) |
| | | { |
| | | var list = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetDoorLockAllAcountUserlist(doorLock); |
| | | localDoorLockUserListTemp = doorLock.localDoorLockUserList; |
| | | } |
| | | doorLock.ReSave(); |
| | | } |
| | | else |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.CloudServerResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(this.btnTip); |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.CloudServerResponseOvertime), Direction = AMPopTipDirection.Down, CloseTime = 1 }.Show(Common.CommonPage.Instance); |
| | | }); |
| | | } |
| | | } |
| | |
| | | { |
| | | MidFrameLayoutContent(); |
| | | CommonPage.Loading.Hide(); |
| | | midVerticalScrolViewLayout.EndHeaderRefreshing(); |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 显示界面 |
| | | /// </summary> |
| | | public void Show() |
| | | { |
| | | this.TopFrameLayout(this, Language.StringByID(R.MyInternationalizationString.UserManagement)); |
| | |
| | | var btnUndistributeText = new Button |
| | | { |
| | | Height = Application.GetRealHeight(72), |
| | | Width = Application.GetRealWidth(121), |
| | | Width = Application.GetRealWidth(150), |
| | | TextID = R.MyInternationalizationString.Undistributed, |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMTopTitleText, |
| | | X = btnUndistributeIcon.Right, |
| | | IsBold = true, |
| | | TextSize = 13, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | }; |
| | | btnAddFrameLayout.AddChidren(btnUndistributeText); |
| | |
| | | btnAddFrameLayout.MouseDownEventHandler += eHandler; |
| | | btnUndistributeText.MouseDownEventHandler += eHandler; |
| | | btnUndistributeIcon.MouseDownEventHandler += eHandler; |
| | | midVerticalScrolViewLayout = new VerticalScrolViewLayout() |
| | | midVerticalScrolViewLayout = new VerticalRefreshLayout() |
| | | { |
| | | }; |
| | | this.midFrameLayout.AddChidren(midVerticalScrolViewLayout); |
| | | ReadAccountList(); |
| | | |
| | | if (localAllAccountListTemp.Count == 0) |
| | | { |
| | | CommonPage.Loading.Start("Loading..."); |
| | | ReadAccountDoorLockInfoList(); |
| | | } |
| | | else |
| | | { |
| | | MidFrameLayoutContent(); |
| | | } |
| | | |
| | | midVerticalScrolViewLayout.BeginHeaderRefreshingAction += () => |
| | | { |
| | | midVerticalScrolViewLayout.BeginHeaderRefreshing(); |
| | | ReadAccountDoorLockInfoList(); |
| | | }; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 中部布局显示 |
| | | /// </summary> |
| | | async void MidFrameLayoutContent() |
| | | { |
| | | midVerticalScrolViewLayout.RemoveAll(); |
| | |
| | | var currentAccount = doorLock.localAllAccountList[i]; |
| | | var RowView = new FrameLayout() |
| | | { |
| | | Height = Application.GetRealHeight(161), |
| | | BackgroundColor = Shared.Common.ZigbeeColor.Current.XMTopFrameLayout, |
| | | Height = Application.GetRealHeight(127 + 23), |
| | | BackgroundColor = Shared.Common.ZigbeeColor.Current.XMWhite, |
| | | }; |
| | | midVerticalScrolViewLayout.AddChidren(RowView); |
| | | |
| | |
| | | X = Application.GetRealWidth(58), |
| | | Width = Application.GetRealWidth(300), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMTopTitleText, |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMBlack, |
| | | Gravity = Gravity.CenterVertical, |
| | | TextSize = 14, |
| | | }; |
| | |
| | | line2.Visible = false; |
| | | } |
| | | |
| | | if (currentAccount.UserName != null) |
| | | if (!string.IsNullOrEmpty(currentAccount.UserName)) |
| | | { |
| | | btnText.Text = currentAccount.UserName; |
| | | } |