예제 #1
0
        private void contacts_SearchCompleted(object sender, Microsoft.Phone.UserData.ContactsSearchEventArgs e)
        {
            _contacts = AlphaKeyGroup <Contact> .CreateGroups(e.Results, System.Threading.Thread.CurrentThread.CurrentUICulture,
                                                              (Contact c) => { return(c.DisplayName); }, true);

            _allContacts = e.Results.ToList();
        }
예제 #2
0
        private void contact_EmailSearchCompleted(object sender, Microsoft.Phone.UserData.ContactsSearchEventArgs e)
        {
            string  address = e.Filter;
            Contact result  = e.Results.FirstOrDefault();

            if (result != null)
            {
                String label = null;
                foreach (ContactEmailAddress email in result.EmailAddresses)
                {
                    if (email.EmailAddress.Equals(address))
                    {
                        label = email.Kind.ToString();
                    }
                }
                ContactFound(this, new ContactFoundEventArgs(result, address, label, (string)e.State));
            }
        }
예제 #3
0
        private void contact_PhoneSearchCompleted(object sender, Microsoft.Phone.UserData.ContactsSearchEventArgs e)
        {
            string  number = e.Filter;
            Contact result = e.Results.FirstOrDefault();

            if (result != null)
            {
                String label = null;
                foreach (ContactPhoneNumber phone in result.PhoneNumbers)
                {
                    // We know this contact has this phone number stored.
                    // That's why we strip the phone number from the 3 first characters (maybe international prefix): to facilitate the label search.
                    if (phone.PhoneNumber.EndsWith(number.Substring(3)))
                    {
                        label = phone.Kind.ToString();
                    }
                }
                ContactFound(this, new ContactFoundEventArgs(result, number, label, (string)e.State));
            }
        }