private void PostDetailForm_FormClosed(object sender, FormClosingEventArgs e) { var mainForm = new MainForm(); var postDetailForm = new PostDetailForm(); mainForm.Show(); postDetailForm.Close(); }
private void PostDetail_Load(object sender, EventArgs e) { var post = GetPost(_postSelect); lbPostTitle.Text = post.post_title; rtbPostDetail.Text = post.post_content; lbUserPost.Text = GetUserOwnPost().username; byte[] avatar = GetUserOwnPost().img; byte[] images = post.img; if (avatar == null) { imgAvatar.Image = Properties.Resources.ClickHere; } else { MemoryStream ms = new MemoryStream(avatar); var avatars = Image.FromStream(ms); imgAvatar.Image = avatars; imgAvatar.SizeMode = PictureBoxSizeMode.StretchImage; } if (images == null) { imgPostDetail.Image = Properties.Resources.SmartOSC; } else { MemoryStream ms = new MemoryStream(images); var image = Image.FromStream(ms); imgPostDetail.Image = image; imgPostDetail.SizeMode = PictureBoxSizeMode.StretchImage; } BtnLikePost.Highlight = CheckIsLike(_postSelect, LoginInfo.userId); lbPostIndexStatus.Text = $@"{CountLike()} people Like and have {CountComment()} comment in this post"; var postDetailForm = new PostDetailForm { Text = post.post_title }; var comments = GetCommentsByPost(_postSelect); var commentOut = (from comment in comments let username = GetUsernameById(comment.author) let dateTime = comment.time where dateTime != null let timeComment = (DateTime)dateTime where username != null && comment.content_text != null select "[ " + username.ToString() + " | " + timeComment.ToString("t") + "] : " + comment.content_text into commentFormat select new SomeData() { Text = commentFormat }).ToList(); lbPostDetailComment.DisplayMember = "Text"; lbPostDetailComment.DataSource = commentOut; }
private void ListboxPostNow_DoubleClick(object sender, EventArgs e) { int?value = ((SomeData)ListboxPostNow.SelectedItem).Value; var postSelected = (int)value; Visible = false; var mainForm = new MainForm(); var postDetailForm = new PostDetailForm(postSelected); mainForm.Hide(); postDetailForm.Show(); }