Samstag, 26. Januar 2013

Windows Phone 8 Access to Contact details

Here is a small snippet to get the contact details with the AddressChooser task and Contact class (new for Windows Phone 8) for an Windows Phone 8 app:

public MainPage()
{
    InitializeComponent();
    addressTask = new AddressChooserTask();
    addressTask.Completed += addressTask_Completed;
}
 
private void btnContacts_Click(object sender, RoutedEventArgs e)
{
    addressTask.Show();
}
 
void addressTask_Completed(object sender, AddressResult e)
{
    if (e.TaskResult == TaskResult.OK)
    {
        var contacts = new Contacts();
        contacts.SearchCompleted += contacts_SearchCompleted;
        contacts.SearchAsync(e.DisplayName, FilterKind.DisplayName, null); 
    }
}
 
private void contacts_SearchCompleted(object sender, ContactsSearchEventArgs e)
{
    if (e.Results != null && e.Results.Any())
    {
        var firstOrDefault = e.Results.FirstOrDefault();
        if (firstOrDefault != null)
        {
            var contactPhoneNumber = firstOrDefault.PhoneNumbers.FirstOrDefault(tel => tel.Kind==PhoneNumberKind.Mobile);
            if (contactPhoneNumber != null)
            {
                TextTelephoneNumber.Text = contactPhoneNumber.PhoneNumber;
                SmsNumber.Text = contactPhoneNumber.PhoneNumber;
               
            }
            var contactEmail = firstOrDefault.EmailAddresses.FirstOrDefault();
            if (contactEmail != null)
            {
                
                MailAddress.Text = contactEmail.EmailAddress;
            }
                
        }
    }
}

Donnerstag, 24. Januar 2013

Windows Phone 8 NFC Tag Manager Update

Today I got good news from the Microsoft Marketplace Team: My new version of the NFC Tag Manager passed the certification and is now available at the marketplace.

With the new Version it is possible to write NFC Tags in NDEF format for the following tasks:

  • make a telephone task 
  • write a SMS
  • write a eMail 
  • Open a Web Site 
  • Open a smart poster 



For choosing a eMail address or the mobile telephone number I used the Adress Chooser task in combination with the new Contacts class to access the contact details.

App-Link: http://www.windowsphone.com/s?appid=eaea845e-fd52-413e-b66f-fcbb03dd4885

Screenshot_create_WXGA



Mittwoch, 16. Januar 2013

Windows Phone 8 NFC Tag Manager

My Windows Phone 8 App “NFC Tag Manager” passed today the certification process and is now available at the Windows Phone Store:

http://www.windowsphone.com/s?appid=eaea845e-fd52-413e-b66f-fcbb03dd4885

The purpose if this Windows Phone App is to read the NDEF content of NFC tags. You can use this, if you have an unknown NFC tag and want to know which content is on it.

Some more NFC functions are coming next.

NFC tag manager