title: Contacts SearchAsync takes a long time
body: <p>Here is my problem: I am creating a WP7 application and need to list all contacts on the mobile device. I know there is the <code>Contacts</code> class with method <code>SearchAsync</code> and <code>SearchCompleted</code> event handler.</p>
  
  <p>This is all working except for one detail; when I am using the application on my phone, the search takes more than 12 seconds! I am using data virtualization to make the UI draw quickly. I have about 400 contacts in my phone. So the problem is, that <code>SearchCompleted</code> is fired after a long time :(</p>
  
  <p>Do you have any ideas how to improve this solution? Should I start inserting contacts in listbox by first letter ("a", "b"... but then that means I need to call SearchAsync repeatedly) and then how can I merge it?</p>
  
  <p>Device: Samsung Omnia 7</p>
  
  <pre><code>ThreadPool.QueueUserWorkItem(result =&gt;
  {
       _cachingRunning = true;
       var contacts = new Contacts();
       contacts.SearchCompleted += contacts_SearchCompleted;
       contacts.SearchAsync(string.Empty, FilterKind.None, null);
  });
  </code></pre>
  
  <p>This method is called almost 12 second after <code>SearchAsync</code>:</p>
  
  <pre><code>private void contacts_SearchCompleted(object sender, ContactsSearchEventArgs e)
  {
              _phoneContacts = e.Results;
              Count = e.Results.Count();      
  
              Deployment.Current.Dispatcher.BeginInvoke(() =&gt;
                  {
                      Cached = true;
                      _cachingRunning = false;
                      CachingChanged();
              });
   }
  </code></pre>
  
  <p>I store <code>_phoneContacts</code> and then use it for filtering; accessing it by Index and Count during data virtualization on ListBox.</p>
  
  <p>This method "works" with <code>VirtualizingDataCollection</code> (Telerik) and creates ViewModel item which is added to <code>VirtualizingDataCollection</code>.</p>
  
  <pre><code>public ObservableCollection&lt;ExtendedContactModel&gt; GetContactsRange(int startIndex, int count)
          {
              var collection = new ObservableCollection&lt;ExtendedContactModel&gt;();
  
              for (var i = startIndex; i &lt; startIndex + count; i++)
              {
                  var vo = ConvertToVO(_phoneContacts.ElementAt(i));
                  var newContact = ConvertToExtendedContactModel(_phoneContacts.ElementAt(i), vo);
  
                  collection.Add(newContact);
              }
              return collection;
          }
  </code></pre>