コード例 #1
0
 public void GetNewsData()
 {
     Task.Run(async() =>
     {
         LoginResponse loginResponse = PingPongNews.Login();
         ListCategoriesResponse categoriesResponse = await PingPongNews.GetListCategories(1, 10);
         Device.BeginInvokeOnMainThread(() =>
         {
             if (categoriesResponse != null && categoriesResponse.success)
             {
                 var Categories = categoriesResponse.data.categories;
                 if (Categories.Count > 0)
                 {
                     foreach (var item in Categories)
                     {
                         this.Children.Add(new ItemNewsPage(item)
                         {
                             Title = item.name
                         });
                     }
                 }
             }
         });
     });
 }
コード例 #2
0
        private void CreateTabCategories()
        {
            Task.Run(async() => {
                LoginResponse loginResponse = PingPongNews.Login();

                ListCategoriesResponse categoriesResponse = await PingPongNews.GetListCategories(1, 10);

                //var ListCategoriesResponse = await GetListCategories();

                Device.BeginInvokeOnMainThread(() => {
                    if (categoriesResponse.success)
                    {
                        var Categories = categoriesResponse.data.categories;

                        foreach (var category in Categories)
                        {
                            Children.Add(new CategoryTab(category));
                        }
                    }
                    else
                    {
                        Debug.WriteLine("List Categories can't get");
                    }
                });
            });
        }
コード例 #3
0
        public async Task GetData()
        {
            Debug.WriteLine("ThreadId: " + Thread.CurrentThread.ManagedThreadId.ToString());
            LoginResponse          loginResponse      = PingPongNews.Login();
            ListCategoriesResponse categoriesResponse = await PingPongNews.GetListCategories(1, 10);

            Device.BeginInvokeOnMainThread(() =>
            {
                if (categoriesResponse != null && categoriesResponse.success)
                {
                    var Categories = categoriesResponse.data.categories;
                    if (Categories.Count > 0)
                    {
                        foreach (var item in Categories)
                        {
                            this.Children.Add(new ItemNewsPage(item));
                        }
                    }
                }
            });
        }