private async void LoadData() { PostList.Clear(); try { List <Post> posts = await dataRetriever.GetPostsAsync(); foreach (Post p in posts) { PostList.Add(p); if (PostList.Count > 10) { PostsLoaderIndicator.IsRunning = false; PostsLoaderIndicator.IsVisible = false; } } } catch (System.Net.WebException e) { PostsLoaderIndicator.IsRunning = false; PostsLoaderIndicator.IsVisible = false; await DisplayAlert("Alert", "Please check your internet connection", "OK"); } }
private async void LoadPosts() { try { List <Post> posts = await _dataRetriever.GetPostsAsync(); PostsList.Clear(); foreach (Post post in posts) { PostsList.Add(post); if (PostsList.Count > 10) { StopActivityIndicator(); } } } catch (WebException) { StopActivityIndicator(); await DisplayAlert("Not Connected", "You are not connected to the Internet. Please Connect and Pull down the page to Refresh", "OK"); } }