private async Task QueryActivity() { UserContentProvider user = new UserContentProvider(); List<ActivityResult> result = await user.QueryFriendActivities(0, GlobalValue.CurrentUserContext.UserId, GlobalValue.CurrentUserContext.MobileToken); ActivityResult = new ObservableCollection<ActivityItem>(); foreach (var item in result) { ActivityResult.Add(ConvertToActivityItem(item)); } //循环添加数据到20条 while(ActivityResult.Count <20) { List<ActivityResult> loop = await user.QueryFriendActivities(ActivityResult[ActivityResult.Count - 1].ActivityId - 1, GlobalValue.CurrentUserContext.UserId, GlobalValue.CurrentUserContext.MobileToken); if (loop.Count == 0) break; foreach (var item in loop) { ActivityResult.Add(ConvertToActivityItem(item)); } } }
public async Task QueryFriendActivitiesTest() { UserContentProvider mine = new UserContentProvider(); LoginResult result = await mine.Login(Config.username, Config.password); List<ActivityResult> nr = await mine.QueryFriendActivities(0, result.Id.ToString(), result.MobileToken); Assert.IsNotNull(nr); }
private async Task MoreActivity() { UserContentProvider user = new UserContentProvider(); List<ActivityResult> result = await user.QueryFriendActivities( ActivityResult[ActivityResult.Count - 1].ActivityId - 1, GlobalValue.CurrentUserContext.UserId, GlobalValue.CurrentUserContext.MobileToken); foreach (var item in result) { ActivityResult.Add(ConvertToActivityItem(item)); } }