예제 #1
0
        public async Task <List <string> > getContacts()
        {
            List <string> listResults        = new List <string>();
            ContactStore  store              = null;
            IReadOnlyList <ContactList> list = null;
            ContactReader reader             = null;
            ContactBatch  batch              = null;

            // *** This RequestStoreAsync() call is where the exception is thrown. All the cases below have the same issue. ***
            //store = await ContactManager.RequestStoreAsync(ContactStoreAccessType.AllContactsReadWrite);
            //store = await ContactManager.RequestStoreAsync(ContactStoreAccessType.AppContactsReadWrite);
            store = await ContactManager.RequestStoreAsync();

            list = await store.FindContactListsAsync();

            foreach (ContactList contactList in list)
            {
                reader = contactList.GetContactReader();
                batch  = await reader.ReadBatchAsync();

                foreach (Contact contact in batch.Contacts)
                {
                    string fullname = contact.FullName; //+ ", " + contact.Name;// + ", " + contact.Emails.First().Address;
                    listResults.Add(fullname);
                    DisplayContact dc = new DisplayContact(contact);
                    vDisplayContact.Add(dc);
                }
            }
            return(listResults);
        }
예제 #2
0
        protected void ItemDoubleClick(object sender, MouseButtonEventArgs e)
        {
            DisplayContact dc = ((ListViewItem)sender).Content as DisplayContact;

            if (dc != null)
            {
                ContactWindow window = new ContactWindow(dc.contact);
                window.Owner = GetWindow(this);
                window.ShowDialog();
            }
        }