public static List <Element> GetABPersonElementFrom(SmsGroupObject sms, bool returnOnlySelected = false) { List <Element> personElements = new List <Element>(); foreach (var a in Contacts.AddressBook.Where(x => x.Type == ABRecordType.Person)) { ABPerson person = a as ABPerson; foreach (var phone in person.GetPhones()) { if (phone.Label.ToString().ToLower().Contains("mobile")) { bool isInGroup = false; try{ isInGroup = (sms != null && sms.Persons.Any(x => x.Id == a.Id)); }catch (Exception ex) { //Console.WriteLine(ex); } if (returnOnlySelected && !isInGroup) { break; } ABPersonElement el = new ABPersonElement(phone.Value, isInGroup, person); personElements.Add(el); } } } return(personElements.OrderBy(x => ((ABPersonElement)x).Person.FirstName).OrderByDescending(x => ((ABPersonElement)x).IsChecked).ToList <Element>()); }
private void SelectNoneContact() { foreach (var element in contact.Elements) { ABPersonElement p = (ABPersonElement)element; //p.Accessory = UITableViewCellAccessory.None; p.IsChecked = false; } }
private void SelectAllContact() { foreach (var element in contact.Elements) { ABPersonElement p = (ABPersonElement)element; //p.Accessory = UITableViewCellAccessory.Checkmark; p.IsChecked = true; } }
public List <ABPerson> GetCheckedContact() { List <ABPerson> result = new List <ABPerson>(); foreach (var el in contactSection.Elements) { ABPersonElement check = el as ABPersonElement; if (check.IsChecked) { result.Add(check.Person); } } return(result); }
public static List<Element> GetABPersonElementFrom(SmsGroupObject sms, bool returnOnlySelected = false) { List<Element> personElements = new List<Element>(); foreach(var a in Contacts.AddressBook.Where (x => x.Type == ABRecordType.Person)) { ABPerson person = a as ABPerson; foreach(var phone in person.GetPhones()) { if(phone.Label.ToString().ToLower().Contains("mobile")){ bool isInGroup = false; try{ isInGroup = (sms != null && sms.Persons.Any(x => x.Id == a.Id)); }catch(Exception ex) { //Console.WriteLine(ex); } if(returnOnlySelected && !isInGroup) break; ABPersonElement el = new ABPersonElement(phone.Value, isInGroup, person); personElements.Add(el); } } } return personElements.OrderBy(x => ((ABPersonElement)x).Person.FirstName).OrderByDescending(x => ((ABPersonElement)x).IsChecked ).ToList<Element>(); }