public void AddItem(Group item)
 {
     this.PhoneContactGroupsCollection.Add(item);
     SaveGroups();
 }
 void FilterContactsPage_Loaded(object sender, RoutedEventArgs e)
 {
     FILTERED_GROUP = MainPage.APPLICATION_DATA.PHONE_CONTACTS.Clone();
     FILTERED_GROUP.ContactsList = FILTERED_GROUP.ContactsList.Where(a => a.PhoneNumber.StartsWith(MainPage.APPLICATION_DATA.CountryCode)).ToList();
     filteredContactsList.ItemsSource = FILTERED_GROUP.ContactsList;
 }
        private async void Contacts_SearchCompleted(object sender, ContactsSearchEventArgs e)
        {
            phoneContactsField = new Group();
            List<Contact> res =
            (from Contact con in e.Results
             where con.PhoneNumbers.Count() == 1
             select con).ToList();

            foreach (Contact contact in res)
            {
                phoneContactsField.ContactsList.Add(new MyContact()
                {
                    DisplayName = contact.DisplayName,
                    PhoneNumber = contact.PhoneNumbers.FirstOrDefault().PhoneNumber.Trim('-', '(', ')', ' '),
                    PhoneNumberType = contact.PhoneNumbers.FirstOrDefault().Kind.ToString(),
                    Checked = false
                });
            }

            res = (from Contact con in e.Results where con.PhoneNumbers.Count() > 1 select con).ToList();

            foreach (Contact contact in res)
            {
                foreach (ContactPhoneNumber contactnumber in contact.PhoneNumbers)
                {
                    phoneContactsField.ContactsList.Add(new MyContact()
                    {
                        DisplayName = contact.DisplayName,
                        PhoneNumber = contactnumber.PhoneNumber,
                        PhoneNumberType = contactnumber.Kind.ToString(),
                        Checked = false
                    });
                }
            }

            phoneContactsField.ContactsList = phoneContactsField.ContactsList.OrderBy(a => a.DisplayName).ToList();
            await MainPage.APPLICATION_DATA.Save(FileKey);
        }
Exemple #4
0
 public Group Clone()
 {
     Group copied = new Group();
     copied.ContactsList = this.ContactsList;
     copied.Filters = this.Filters;
     copied.GroupName = this.GroupName;
     return copied;
 }