Пример #1
0
        /* This is called when addressbook scanning on phone gets completed.*/
        public static void contactSearchCompleted_Callback(object sender, ContactsSearchEventArgs e)
        {
            try
            {
                Debug.WriteLine("Contact Scanning Completed ...... ");
                st.Stop();
                long msec = st.ElapsedMilliseconds;
                Debug.WriteLine("Time to scan contacts from phone : {0}", msec);

                BackgroundWorker bw = new BackgroundWorker();
                bw.DoWork += (ss, ee) =>
                {
                    if (e != null && e.Results != null)
                    {
                        contactsMap = getContactsListMap(e.Results);
                    }
                    cState = ContactScanState.ADDBOOK_SCANNED;
                };
                bw.RunWorkerAsync();
            }
            catch (System.Exception)
            {
                //That's okay, no results//
            }
        }
Пример #2
0
        public static void getContacts(contacts_Callback callback)
        {
            st = Stopwatch.StartNew();
            Debug.WriteLine("Contact Scanning started .....");
            cState = ContactScanState.ADDBOOK_SCANNING;
            Contacts cons = new Contacts();

            cons.SearchCompleted += new EventHandler <ContactsSearchEventArgs>(callback);
            cons.SearchAsync(string.Empty, FilterKind.None, "State string 1");
        }