// Displays reply box when clicked if user is logged in public void replyIcon_MouseClick(object sender, EventArgs e) { // Verifies that a user is logged in if (Program.loggedInUserID != -1) { panel.Height = HEIGHT + ADDITIONAL_REPLY_SPACE; form.updatePanelLocations(); } else { MessageBox.Show("You must be logged in to reply to a post."); } }
// Submits comment void commentSubmit_MouseClick(object sender, EventArgs e) { string commentContent = commentBox.Text; try // Check for foul language { Program.CheckFoulLanguage(commentContent); } catch (Program.FoulLanguageException except) // Caught foul language { MessageBox.Show("Caught a FoulLanguageException: " + except); return; } if (post.Locked == true) // Post is locked { MessageBox.Show("Post is marked as 'Locked' -- replies are disabled."); } else if (commentBox.Text.Equals("")) { MessageBox.Show("Please enter a comment."); } else // Add comment to post { Comment newComment = new Comment(commentContent, (uint)Program.loggedInUserID, post.ID); post.addComment(newComment); Program.idDictionary.Add(newComment.ID, newComment); commentBox.Text = ""; form.addComment(newComment); form.updatePanelLocations(); //append to file new comment using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"..\\..\\..\\comments.txt", true)) { file.WriteLine(newComment.ID + "\t" + Program.loggedInUserID + "\t" + newComment.Content + "\t" + newComment.ParentID + "\t" + newComment.UpVotes + "\t" + newComment.DownVotes + "\t" + newComment.TimeStamp.Year + "\t" + newComment.TimeStamp.Month + "\t" + newComment.TimeStamp.Day + "\t" + newComment.TimeStamp.Hour + "\t" + newComment.TimeStamp.Minute + "\t" + newComment.TimeStamp.Second + "\t" + newComment.Silver + "\t" + newComment.Gold + "\t" + newComment.Platinum); } } }