コード例 #1
0
        private void getProfilePosts()
        {
            Task.Run(async() =>
            {
                return(await Api.DavinciApi.GetProfilePosts());
            }).ContinueWith(t =>
            {
                if (t.Status == TaskStatus.Canceled)
                {
                    return;
                }

                if (t.Result.OK)
                {
                    CategoryGridAdapter likedPostAdapter = new CategoryGridAdapter(t.Result.likedPosts);
                    CategoryGridAdapter userPostAdapter  = new CategoryGridAdapter(t.Result.userPosts);

                    Action <PostModel> onClickPost = (post) =>
                    {
                        PostFragment postFragment = PostFragment.newInstance(post._id);
                        postFragment.Show(parentActivity.SupportFragmentManager, "post");
                    };
                    likedPostAdapter.ItemClick += onClickPost;
                    userPostAdapter.ItemClick  += onClickPost;

                    likesRecyclerView.SetAdapter(likedPostAdapter);
                    postsRecyclerView.SetAdapter(userPostAdapter);
                }
            }, TaskScheduler.FromCurrentSynchronizationContext());
        }
コード例 #2
0
 private void getProfilePosts()
 {
     Task.Run(async() =>
     {
         return(await Api.DavinciApi.GetProfilePosts());
     }).ContinueWith(t =>
     {
         if (t.Result.OK)
         {
             CategoryGridAdapter adapter = new CategoryGridAdapter(t.Result.posts);
             adapter.ItemClick          += (post) =>
             {
                 PostFragment postFragment = PostFragment.newInstance(post._id);
                 postFragment.Show(parentActivity.SupportFragmentManager, "post");
             };
             likesRecyclerView.SetAdapter(adapter);
         }
     }, TaskScheduler.FromCurrentSynchronizationContext());
 }