Exemplo n.º 1
0
 private void getPosts(string id)
 {
     Task.Run(async() =>
     {
         SingleCategoryModel postCollection = await Api.DavinciApi.GetCategoryPosts(id);
         return(postCollection);
     }).ContinueWith(t =>
     {
         RunOnUiThread(() =>
         {
             var viewAdapter        = new CategoryGridAdapter(t.Result.category.posts);
             viewAdapter.ItemClick += (p) =>
             {
                 PostFragment postFragment = PostFragment.newInstance(p._id);
                 postFragment.Show(SupportFragmentManager, "post");
             };
             recyclerView.SetAdapter(viewAdapter);
         });
     }, TaskScheduler.FromCurrentSynchronizationContext());
 }
Exemplo n.º 2
0
        private void getPosts()
        {
            Task.Run(async() =>
            {
                return(await Api.DavinciApi.GetCategoryPosts(id));
            }).ContinueWith(t =>
            {
                if (t.Status == TaskStatus.Canceled)
                {
                    return;
                }

                if (t.Result.OK)
                {
                    var viewAdapter        = new CategoryGridAdapter(t.Result.category.posts);
                    viewAdapter.ItemClick += (p) =>
                    {
                        PostFragment postFragment = PostFragment.newInstance(p._id);
                        postFragment.Show(SupportFragmentManager, "post");
                    };
                    recyclerView.SetAdapter(viewAdapter);
                }
            }, TaskScheduler.FromCurrentSynchronizationContext());
        }