protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here
            SetContentView(Resource.Layout.PostActivityLayout);

            Task t = Task.Run(async () => 
            {
                var res = await PostAPI.GetPostById(Intent.GetIntExtra("PostID", 0), AppPersistent.UserToken);
                if(res.error)
                {
                    FeedbackHelper.ShowPopup(this, res.message);
                    return;
                }
                m_PostData = res.data[0];
            });

            t.Wait();
            InitContent();
            m_CommentsList = FindViewById<ListView>(Resource.Id.PostCommentsList);
            Button sendBtn = FindViewById<Button>(Resource.Id.PostSendComment);
            sendBtn.Click += SendBtn_Click;
            //t.ContinueWith(ct => InitContent());
            t = Task.Run(async () =>
            {
                var res = await PostAPI.GetCommentsForPost(Intent.GetIntExtra("PostID", 0));
                if(res.error)
                {
                    return;
                }
                m_CommentsList.Adapter = new CommentAdapter(this, res.data);
            });
        }
Example #2
0
        async void UpdateComments(int id)
        {
            var commentsData = await PostAPI.GetCommentsForPost(id);

            if (commentsData.data.Count == 0)
            {
                return;
            }
            lstComments.Items.Clear();
            for (int i = commentsData.data.Count - 1; i > -1; --i)
            {
                UserComment commentWidget = new UserComment();
                commentWidget.UserName  = commentsData.data[i].user.name;
                commentWidget.Comment   = commentsData.data[i].text;
                commentWidget.ImageURL  = commentsData.data[i].user.photo;
                commentWidget.UserID    = commentsData.data[i].user.id;
                commentWidget.CommentID = commentsData.data[i].id;
                lstComments.Items.Add(commentWidget);
            }
        }