/// <summary> /// 刷新 赞排行榜 /// </summary> /// <param name="rankTimeIndex"></param> public async Task RefreshVoteCollectionAsync(int rankTimeIndex) { IsActive = true; VoteCollection.Clear(); var result = await LoadRankDataAsync(RankTypeEnum.vote, (RankTimeEnum)rankTimeIndex); if (result == null) { return; } foreach (var item in result) { VoteCollection.Add(item); } IsActive = false; }
private async Task GetVotes() { Ui(() => { Loading = true; }); var votes = (await _homeApiClient.GetCurrentVotes()).ToList(); var voteVms = votes.Select(v => new BlockchainViewModel(v)); Ui(() => { Loading = false; if (votes.Any()) { VoteCollection.Clear(); VoteCollection.AddRange(voteVms); VoteSource.Refresh(); NoVotes = false; } else { NoVotes = true; } }); }