private void loadContacts(UserAccountRole ofRole) { lstContacts.ItemChecked -= lstContacts_ItemChecked; lstContacts.SelectedIndices.Clear(); lstContacts.Items.Clear(); var contacts = IntuneService.GetAllContacts(); var userIds = IntuneService.GetAccountUsers(Account.Id, ofRole); foreach (var contact in contacts) { if (!contact.HasIntune()) { continue; } var lvi = lstContacts.Items.Add(contact.Name); lvi.ForeColor = Color.Blue; lvi.Font = new Font(lstContacts.Font, FontStyle.Regular); lvi.Checked = userIds.Where(u => u == contact.ContactUserId).Count() > 0; lvi.Tag = contact; } if (lstContacts.Items.Count > 0) { lstContacts.SelectedIndices.Add(0); } lstContacts.Select(); lstContacts.ItemChecked += lstContacts_ItemChecked; }
private void loadContacts() { lstContacts.SelectedIndices.Clear(); lstContacts.Items.Clear(); var contacts = IntuneService.GetAllContacts(); foreach (var contact in contacts) { var lvi = lstContacts.Items.Add(contact.Name); var intune = contact.HasIntune() ? "Yes" : "No"; lvi.SubItems.Add(intune); lvi.ForeColor = Color.Blue; lvi.Font = new Font(lstContacts.Font, FontStyle.Regular); lvi.Tag = contact; if (contact.HasUnreadComments) { lvi.ImageIndex = 0; } else if (contact.HasComments) { lvi.ImageIndex = 2; } } if (lstContacts.Items.Count > 0) { lstContacts.SelectedIndices.Add(0); } lstContacts.Select(); }
private void loadContacts() { lstContacts.SelectedIndices.Clear(); lstContacts.Items.Clear(); var contacts = IntuneService.GetAllContacts(); foreach (var contact in contacts) { if (ShowOnlyIntuneContacts && !contact.HasIntune()) { continue; } var lvi = lstContacts.Items.Add(contact.Name); var intune = contact.HasIntune() ? "Yes" : "No"; lvi.SubItems.Add(intune); lvi.ForeColor = Color.Blue; lvi.Font = new Font(lstContacts.Font, FontStyle.Regular); lvi.Tag = contact; } if (lstContacts.Items.Count > 0) { lstContacts.SelectedIndices.Add(0); } lstContacts.Select(); }