private void updatePostStatistics(PostsStatistics i_PostsStatistics) { labelStatisticsPostsTotal.Text = r_AppData.LoggedInUser.Posts.Count.ToString(); labelStatisticsPostsPostsTaggedIn.Text = r_AppData.LoggedInUser.PostsTaggedIn.Count.ToString(); labelStatisticsPostsMostLikes.Text = i_PostsStatistics.MostLikedCount.ToString(); labelStatisticsPostsMostLikesByUserCount.Text = i_PostsStatistics.UserWithMostLikesCount.ToString(); labelStatisticsPostsMostLikesByUserName.Text = i_PostsStatistics.UserWithMostLikes?.Name; labelStatisticsPostsMostPostsWithCount.Text = i_PostsStatistics.UserWithMostMutualPostsCount.ToString(); labelStatisticsPostsMostPostsWithName.Text = i_PostsStatistics.UserWithMostMutualPosts?.Name; labelStatisticsPostsTotalLikes.Text = i_PostsStatistics.TotalLikes.ToString(); richTextBoxMostLikedPost.Text = i_PostsStatistics.MostLiked?.Message; }
private void generatePostStatistics() { try { PostsStatistics postsStatistics = r_AppData.GetPostsStatistics(); panelStatisticsPosts.Invoke(new Action(() => updatePostStatistics(postsStatistics))); } catch (Exception) { MessageBox.Show("Couldn't fetch your posts!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }