async Task LoadMoreItemsAsync(bool refresh = false) { if (!HasMoreItems && !refresh) { IsLoading = false; return; } try { if (refresh) { PageCount = 1; Pagination = PaginationParameters.MaxPagesToLoad(1); try { Views.Main.ExploreView.Current?.ShowTopLoading(); } catch { } try { Views.Main.ExploreClusterView.Current?.ShowTopLoading(); } catch { } //try //{ // Views.Posts.ScrollableExplorePostView.Current?.ShowTopLoading(); //} //catch { } } else { try { Views.Main.ExploreView.Current?.ShowBottomLoading(); } catch { } try { Views.Main.ExploreClusterView.Current?.ShowBottomLoading(); } catch { } //try //{ // Views.Posts.ScrollableExplorePostView.Current?.ShowBottomLoading(); //} //catch { } } var result = await InstaApi.FeedProcessor.GetTopicalExploreFeedAsync(Pagination, ClusterId); //if (DeviceUtil.IsMobile) Pagination.MaximumPagesToLoad = 2; PageCount++; FirstRun = false; if (!result.Succeeded) { IsLoading = false; if (result.Value == null || result.Value.Medias?.Count == 0) { Hide(refresh); return; } } HasMoreItems = result.Value.MoreAvailable; Pagination.NextMaxId = result.Value.NextMaxId; if (refresh) { Items.Clear(); ItemsX.Clear(); } if (result.Value.Medias?.Count > 0) { //Items.AddRange(result.Value.Medias); //ItemsX.AddRange(result.Value.Medias); for (int i = 0; i < result.Value.Medias.Count; i++) { var l = result.Value.Medias[i]; if (!Items.Any(x => x.InstaIdentifier == l.InstaIdentifier)) { Items.Add(l); //ItemsX.Add(l); } } } if (result.Value.Clusters?.Count > 0) { Clusters.Clear(); if (result.Value.Clusters[0].Title.ToLower() == "for you") { result.Value.Clusters.RemoveAt(0); } Clusters.AddRange(result.Value.Clusters); } if (result.Value.Channel != null) { Channel = result.Value.Channel; } await Task.Delay(1000); IsLoading = false; if (refresh /*&& DeviceUtil.IsMobile*/) { RunLoadMore(); } } catch (Exception ex) { ex.PrintException("ExploreClusterGenerator.LoadMoreItemsAsync"); } FirstRun = IsLoading = false; Hide(refresh); }