private void listBox2_DoubleClick(object sender, EventArgs e) { if (listBox2.SelectedItem != null) { CommentUI c = (CommentUI)listBox2.SelectedItem; MessageBox.Show(c.date, "Data de Publicação"); } }
private void metroButton1_Click(object sender, EventArgs e) { String text = metroTextBox1.Text; if (string.IsNullOrWhiteSpace(text) == false) { text = v.FIRSTNAME + " " + v.LASTNAME + ": " + metroTextBox1.Text; CommentUI u = new CommentUI { txt = text, date = Time.get() }; listBox2.DisplayMember = "txt"; listBox2.Items.Add(u); comments.Add(text + " [" + Time.get() + "]"); linked.COMMENTS = Databases.compactList(comments); PostManager.updateComments(linked); } metroTextBox1.Text = ""; }
public PostViewer(Post p, Boolean debug, User viewer) { v = viewer; InitializeComponent(); Region = System.Drawing.Region.FromHrgn(CreateRoundRectRgn(0, 0, Width, Height, 20, 20)); label1.Text = p.NAME; label2.Text = "🕐 " + p.POSTDATE; metroCheckBox1.CheckedChanged -= MetroCheckBox1_CheckedChanged; metroCheckBox2.CheckedChanged -= MetroCheckBox2_CheckedChanged; inters = Databases.uncompactList(p.INTERACTION1); comments = Databases.uncompactList(p.COMMENTS); foreach (String s in inters) { string[] data = s.Split('-'); String ID = data[0]; if (ID == viewer.IDENTIFIER) { inter = Int32.Parse(data[1]); if (inter == 0) { inter = 0; } if (inter == 1) { metroCheckBox1.Checked = true; inter = 1; } if (inter == 2) { metroCheckBox2.Checked = true; inter = 2; } } } metroCheckBox1.CheckedChanged += MetroCheckBox1_CheckedChanged; metroCheckBox2.CheckedChanged += MetroCheckBox2_CheckedChanged; label3.Text = "Likes: " + p.LIKES + " | Dislikes: " + p.DISLIKES; listBox1.Items.AddRange(Databases.uncompactList(p.TEXT).ToArray()); foreach (String s in comments) { if (string.IsNullOrWhiteSpace(s) == false) { int pFrom = s.IndexOf("[") + "[".Length; int pTo = s.LastIndexOf("]"); String result = s.Substring(pFrom, pTo - pFrom); listBox2.DisplayMember = "txt"; CommentUI c = new CommentUI { txt = s.Replace("[" + result + "]", ""), date = result }; listBox2.Items.Add(c); } } if (debug == true) { groupBox1.Visible = true; debugger.Enabled = true; debugger.Start(); } linked = p; }