public void fillContacts() { lv_Contacts.Items.Clear(); bday.connections.Sort((a, b) => a.orderer.CompareTo(b.orderer)); foreach (Connection c in bday.connections) { ListViewItem lvi = new ListViewItem(); lvi.ImageIndex = cti.getIndex(c.type); lvi.Tag = c.id; lvi.Text = c.orderer + ""; lvi.SubItems.Add(c.type.ToString()); lvi.SubItems.Add(c.contactstring); lv_Contacts.Items.Add(lvi); } if (itemNewId != -1) { lv_Contacts.FocusedItem = lv_Contacts.Items[itemNewId]; lv_Contacts.Items[itemNewId].Selected = true; lv_Contacts.EnsureVisible(itemNewId); } }
public void loadBdayData(Birthday b) { try { lbl_Name.Text = b.name; lbl_Birthday.Text = b.birthday.ToShortDateString(); connToImg cti = new connToImg(); lv_ContactInfo.Items.Clear(); foreach (Connection c in b.connections) { ListViewItem lvi = new ListViewItem(); lvi.ImageIndex = cti.getIndex(c.type); lvi.Tag = c.id; lvi.Text = (c.type.ToString()); lvi.SubItems.Add(c.contactstring); lv_ContactInfo.Items.Add(lvi); } lv_Alerts.Items.Clear(); foreach (Alert a in b.alerts) { ListViewItem lvi = new ListViewItem(); lvi.Text = a.alert.Month + ". " + a.alert.Day + "."; lvi.SubItems.Add(a.showText ? a.text : "--"); lvi.SubItems.Add(a.makeSound ? a.sound + "" : "--"); lv_Alerts.Items.Add(lvi); } pb_Edit_Picture.Image = b.image; p_Color.BackColor = b.birthdayColor; sc_Main.Panel2Collapsed = false; } catch { } }