private async Task LoadTrendingRepos(TimeRange range) { if (range == TimeRange.TODAY) { IsLoadingToday = CanLoadMoreToday = true; var repos = await RepositoryUtility.GetTrendingRepos(range, true); IsLoadingToday = false; if (repos != null) { ZeroTodayCount = false; FirstTrendingReposToday = repos[0]; repos.RemoveAt(0); TrendingReposToday = repos; } else { ZeroTodayCount = true; if (TrendingReposToday != null) { TrendingReposToday.Clear(); } } } else if (range == TimeRange.WEEKLY) { IsLoadingWeek = CanLoadMoreWeek = true; var repos = await RepositoryUtility.GetTrendingRepos(range, true); IsLoadingWeek = false; if (repos != null) { ZeroWeeklyCount = false; FirstTrendingReposWeek = repos[0]; repos.RemoveAt(0); TrendingReposWeek = repos; } else { ZeroWeeklyCount = true; if (TrendingReposWeek != null) { TrendingReposWeek.Clear(); } } } else { IsLoadingMonth = CanLoadMoreMonth = true; var repos = await RepositoryUtility.GetTrendingRepos(range, true); IsLoadingMonth = false; if (repos != null) { ZeroMonthlyCount = false; FirstTrendingReposMonth = repos[0]; repos.RemoveAt(0); TrendingReposMonth = repos; } else { ZeroMonthlyCount = true; if (TrendingReposMonth != null) { TrendingReposMonth.Clear(); } } } }
private async Task LoadTrendingRepos(TimeRange range) { if (range == TimeRange.TODAY) { var repos = await RepositoryUtility.GetTrendingRepos(range, true); IsLoadingToday = false; if (repos != null) { TrendingReposToday = repos; IsIncrementalLoadingToday = true; //Second Incremental call repos = await RepositoryUtility.GetTrendingRepos(range, false); IsIncrementalLoadingToday = false; if (repos != null) { foreach (var i in repos) { TrendingReposToday.Add(i); } } } else { ZeroTodayCount = true; if (TrendingReposToday != null) { TrendingReposToday.Clear(); } } } else if (range == TimeRange.WEEKLY) { var repos = await RepositoryUtility.GetTrendingRepos(range, true); IsLoadingWeek = false; if (repos != null) { TrendingReposWeek = repos; IsIncrementalLoadingWeek = true; //Second Incremental call repos = await RepositoryUtility.GetTrendingRepos(range, false); IsIncrementalLoadingWeek = false; if (repos != null) { foreach (var i in repos) { TrendingReposWeek.Add(i); } } } else { ZeroWeeklyCount = true; if (TrendingReposWeek != null) { TrendingReposWeek.Clear(); } } } else { var repos = await RepositoryUtility.GetTrendingRepos(range, true); IsLoadingMonth = false; if (repos != null) { TrendingReposMonth = repos; IsIncrementalLoadingMonth = true; //Second Incremental call repos = await RepositoryUtility.GetTrendingRepos(range, false); IsIncrementalLoadingMonth = false; if (repos != null) { foreach (var i in repos) { TrendingReposMonth.Add(i); } } } else { ZeroMonthlyCount = true; if (TrendingReposMonth != null) { TrendingReposMonth.Clear(); } } } }