private void GetData() { // Debug.WriteLine("CurrentPage : " + (this.CurrentPage + 1)); Task.Run(async() => { var ListCategoriesNewsResponse = await PingPongNews.GetCategoryNews((this.CurrentPage + 1), this.LimitRecord, _category.slug); Device.BeginInvokeOnMainThread(() => { if (ListCategoriesNewsResponse.success) { var listNews = ListCategoriesNewsResponse.data.news; if (listNews.Count > 0) { this._lstNews.AddRange(listNews); // Debug.WriteLine("listNews : " + listNews.Count); } var listView = this.Content as ListView; listView.ItemsSource = null; listView.ItemsSource = this._lstNews; //Debug.WriteLine(this._category.name + " : " + _lstNews.Count); } }); }); }
public void GetData() { Task.Run(async() => { var ListCategoriesNewsResponse = await PingPongNews.GetCategoryNews((this.CurrentPage + 1), this.LimitRecord, _category.slug); Device.BeginInvokeOnMainThread(() => { if (Device.RuntimePlatform == Device.iOS) { var title = _category.name.Substring(0, 9); titleNews = title; } else { titleNews = _category.name; } listNews = new List <Sport.News.News>(); if (ListCategoriesNewsResponse != null && ListCategoriesNewsResponse.success) { var listNews = ListCategoriesNewsResponse.data.news; if (listNews.Count > 0) { this.listNews.AddRange(listNews); } } }); }); }