private async void PostPage_Loaded(object sender, RoutedEventArgs e) { var res = await PostAPI.GetPostById(GeneralBlackboard.TryGetValue <int>(BlackBoardValues.EPostData), AppPersistent.UserToken); if (res.error) { DialogManager.ShowDialog("F U C K", res.message); } m_PostData = res.data[0]; if (m_PostData != null) { wdgComment.PostID = m_PostData.id; m_PosterId = m_PostData.owner_id; //wdgPost.CurrentPostData = post; //wdgPost.PostText = post.text; //wdgPost.ImageURL = post.attachments[0].photo.photo_medium; txtPost.Text = m_PostData.text; imgPost.Source = new BitmapImage(new Uri(m_PostData.attachments[0].photo.photo_medium, UriKind.Absolute)); lblPosterName.Content = m_PostData.owner_name; //lblPosterName.IsEnabled = post.author_watch == 1 ? false : true; lblDate.Content = UnixTimeStampToDateTime(m_PostData.date).ToString(); UpdateComments(m_PostData.id); } }
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); }); }
private async void UpdateTimer_Tick(object sender, EventArgs e) { var res = await PostAPI.GetPostById(GeneralBlackboard.TryGetValue <int>(BlackBoardValues.EPostData), AppPersistent.UserToken); if (res.error) { DialogManager.ShowDialog("F U C K", res.message); } m_PostData = res.data[0]; if (m_PostData != null) { UpdateComments(m_PostData.id); } }