示例#1
0
        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>());
        }
示例#2
0
 private void SelectNoneContact()
 {
     foreach (var element in contact.Elements)
     {
         ABPersonElement p = (ABPersonElement)element;
         //p.Accessory  = UITableViewCellAccessory.None;
         p.IsChecked = false;
     }
 }
示例#3
0
 private void SelectAllContact()
 {
     foreach (var element in contact.Elements)
     {
         ABPersonElement p = (ABPersonElement)element;
         //p.Accessory  = UITableViewCellAccessory.Checkmark;
         p.IsChecked = true;
     }
 }
示例#4
0
        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);
        }
示例#5
0
        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>();
        }