public void AddPost(Post post) { post.IsNewPost = true; this.posts.Add(post); }
public void RemovePost(Post p) { this.posts.Remove(p); }
public void UpdatePostDetails(Post p) { if (p == null) { this.grpPostStats.Hide(); return; } if (this.WindowState == FormWindowState.Minimized) return; // Prevent invalid stuff when form is minimized. this.grpPostStats.Show(); this.lblPostDate.Text = p.PostTime.ToString("MM/dd/yy(ddd)HH:mm"); this.lblPostImgPath.Text = p.ImagePath; frmMain_ToolTip.SetToolTip(this.lblPostImgPath, p.ImagePath); if (p.ImagePath.Contains("http:")) { this.lblPostImgInfo.Text = "Unavailable."; this.picPostImg.Visible = false; } else { // Blank the picturebox. if (this.picPostImg.Image != null) this.picPostImg.Image.Dispose(); this.picPostImg.Image = new Bitmap(Math.Max(1, this.picPostImg.Width), Math.Max(1, this.picPostImg.Height)); // Blt the image. Image i = this._getImage(p.ImagePath); if (i == null) return; this.lblPostImgInfo.Text = string.Format("{0} ({1}x{2})", Program._humanReadableFileSize(new FileInfo(p.ImagePath).Length), i.Width, i.Height); this._resizeImage(this.picPostImg.Image, i); this.picPostImg.Visible = true; } this.picPostImg.Tag = p; }