From ec35d79add60d1438dff5291389f7e69c579d9f9 Mon Sep 17 00:00:00 2001 From: xm <1271024303@qq.com> Date: 星期四, 21 十一月 2019 18:18:25 +0800 Subject: [PATCH] 完成面板楼层显示处理和下拉刷新处理,请合并最新代码 --- ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UndistributeDoorlockUserPage.cs | 134 ++++---------------------------------------- 1 files changed, 14 insertions(+), 120 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UndistributeDoorlockUserPage.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UndistributeDoorlockUserPage.cs index 78144d0..699da40 100644 --- a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UndistributeDoorlockUserPage.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UndistributeDoorlockUserPage.cs @@ -22,17 +22,15 @@ FrameLayout bottomFrameLayout; string currentType = string.Empty; List<Shared.Phone.UserCenter.MemberInfoRes> localAccountList; - VerticalScrolViewLayout bodyView; + VerticalRefreshLayout bodyView; #endregion void ReadDoorLockUserInfo() { System.Threading.Tasks.Task.Run(async () => { - Application.RunOnMainThread(() => { CommonPage.Loading.Start("Loading..."); }); try { - //await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetLocaDoorLocklist(doorLock, curAccountObj); var list = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetDoorLockAllAcountUserlist(doorLock); } catch { } @@ -41,120 +39,6 @@ Application.RunOnMainThread(() => { RefreshList(); - CommonPage.Loading.Hide(); - }); - } - }); - } - - void ReadDoorLockUserInfo1() - { - System.Threading.Tasks.Task.Run(async () => - { - Application.RunOnMainThread(() => { CommonPage.Loading.Start("Loading..."); }); - try - { - var getDoorLockInfo = await doorLock.GetDoorlockUserInfoAsync(); - if (getDoorLockInfo != null && getDoorLockInfo.doorLockUserDetailData != null) - { - var dataList = getDoorLockInfo.doorLockUserDetailData.UserObjList; - foreach (var doorData in dataList) - { - var localDoorLockObj1 = new ZigBee.Device.DoorLock.LocaDoorLockObj() - { - UserID = doorData.UserId, - UnlockType = doorData.UserType - }; - if ((doorLock.localDoorLockUserList.ContainsKey(localDoorLockObj1.UserID)) == false) - { - doorLock.localDoorLockUserList.Add(localDoorLockObj1.UserID, localDoorLockObj1); - } - } - - // 璇诲彇浜戠闂ㄩ攣璁惧涓殑淇℃伅 - var localDoorLockObj = new ZigBee.Device.DoorLock.GetDoorLockData() { }; - - foreach (var curAccountObj in doorLock.localAllAccountList) - { - if (UserCenterResourse.UserInfo.AuthorityNo != 1) - { - localDoorLockObj.LoginAccessToken = UserCenterLogic.GetConnectMainToken(); - localDoorLockObj.IsOtherAccountCtrl = true; - } - localDoorLockObj.CloudAccountId = curAccountObj.SubAccountDistributedMark; - if (doorLock.DeviceAddr != null) - { - localDoorLockObj.DoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint; - } - var getDoorLockInfoList = await ZigBee.Device.DoorLock.GetDoorLockInfoFromServer("DoorLock/GetDoorLockPager", localDoorLockObj); - if (getDoorLockInfoList != null) - { - foreach (var curDoorLockUser in getDoorLockInfoList.PageData) - { - if (curDoorLockUser.DoorLockLocalUserId == null || curDoorLockUser.DoorLockLocalUserId == "") - { - continue; - } - if (doorLock.localDoorLockUserList.ContainsKey(int.Parse(curDoorLockUser.DoorLockLocalUserId))) - { - var doorLockObj = new ZigBee.Device.DoorLock.LocaDoorLockObj() { }; - doorLockObj.UserID = int.Parse(curDoorLockUser.DoorLockLocalUserId); - doorLockObj.UnlockType = curDoorLockUser.OpenLockMode; - doorLockObj.PrimaryId = curDoorLockUser.Id; - doorLockObj.EntryTime = curDoorLockUser.EntryTime; - doorLockObj.UserName = curDoorLockUser.UserIdRemarks; - doorLockObj.ConnectedAccount = curDoorLockUser.CloudAccountId; - doorLock.localDoorLockUserList[int.Parse(curDoorLockUser.DoorLockLocalUserId)] = doorLockObj; - } - else - { - if (curDoorLockUser.DoorLockLocalUserId != null) - { - //闂ㄩ攣涓病鏈夛紝浜戠鏈夌敤鎴稩D锛屽悗鍙板垹闄や簯绔繖浜汭D - var deleteDoorLockData = new ZigBee.Device.DoorLock.DeleteDoorLockData(); - if (UserCenterResourse.UserInfo.AuthorityNo != 1) - { - deleteDoorLockData.LoginAccessToken = UserCenterLogic.GetConnectMainToken(); - deleteDoorLockData.IsOtherAccountCtrl = true; - } - if (doorLock.DeviceAddr != null) - { - deleteDoorLockData.DoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint; - } - deleteDoorLockData.DoorLockLocalUserId = curDoorLockUser.DoorLockLocalUserId; - deleteDoorLockData.PrimaryId = curDoorLockUser.Id; - deleteDoorLockData.DelDoorLockDelType = 2; - var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/DelDoorLock", deleteDoorLockData); - int i = 0; - } - } - } - } - else - { - Application.RunOnMainThread(() => - { - new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.CloudServerResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance); - return; - }); - } - } - } - else - { - //鏁版嵁濡傛灉鍦ㄩ棬閿佷笂闈㈡槸绌虹殑鏃跺�欙紝鏁版嵁涔熸槸娌℃湁鐨� - Application.RunOnMainThread(() => - { - new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance); - }); - } - } - catch { } - finally - { - Application.RunOnMainThread(() => - { - MidFrameLayoutContent(); CommonPage.Loading.Hide(); }); } @@ -178,9 +62,13 @@ MidFrameLayoutContent(); if (doorLock.localDoorLockUserList.Count == 0) { + CommonPage.Loading.Start("Loading..."); ReadDoorLockUserInfo(); } - RefreshList(); + else + { + RefreshList(); + } } public void MidFrameLayoutContent() @@ -228,12 +116,18 @@ }; this.midFrameLayout.AddChidren(btnLine); - bodyView = new VerticalScrolViewLayout() + bodyView = new VerticalRefreshLayout() { - Y = midTopFrameLayout.Bottom, + Y = btnLine.Bottom, Height = Application.GetRealHeight(1921 - 184 - 115 - 1), }; this.midFrameLayout.AddChidren(bodyView); + bodyView.BeginHeaderRefreshingAction += () => + { + bodyView.BeginHeaderRefreshing(); + ReadDoorLockUserInfo(); + bodyView.EndHeaderRefreshing(); + }; } void RefreshList() -- Gitblit v1.8.0