private void userReactToPost(Button i_RelevantButton, bool i_Like) { label = (Label)i_RelevantButton.Parent.Controls.Find("likesAndComments", false).First(); Post relevantPost = (label.Tag as Post); if (i_Like) { relevantPost.AmountOfLikes += relevantPost.IsLikedByUser ? (-1) : 1; relevantPost.IsLikedByUser = !relevantPost.IsLikedByUser; label.Parent.Controls.Remove(i_RelevantButton); i_RelevantButton = buildLikeButton(relevantPost, int.Parse(i_RelevantButton.Name.Substring(i_RelevantButton.Name.Length - 1))); label.Parent.Controls.Add(i_RelevantButton); } else { Form commentWindow = new commentForm(); commentWindow.ShowDialog(); if (commentWindow.DialogResult == DialogResult.OK) { commentWindow.Tag = false; relevantPost.AmountOfComments += 1; } } updateAmounts(label); i_RelevantButton.Parent.Controls.Remove(label); i_RelevantButton.Parent.Controls.Add(label); }
private bool enableCommentOnPost() { bool commentCompleted = false; Form commentWindow = new commentForm(); commentWindow.ShowDialog(); if (commentWindow.DialogResult == DialogResult.OK) { commentCompleted = true; } return(commentCompleted); }