Tuesday, 8 July 2014

Choosers in Windows Phone 8 using Visual Studio 2013

I will assume that you have installed the tools for working like Visual Studio 2012 ( or 2013 ) and that you’re on Windows 8 at least ( or 8.1 ) .
You can use Choosers in your Windows Phone applications to enable users to perform common tasks. By using choosers , you help provide a consistent user experience throughout the Windows Phone platform. At the same time, by using choosers , you can distinguish your applications by providing additional functionality such us choosing an email , a phone number , or an address inside the application and much more .
Let’s learn now how to use this great tool  , Go ahead and create a new project , then follow these steps :
The first thing that we will do is to create four buttons in our application , you can write the XAML code or just preform a simple drag and drop , then let’s change the names of our buttons like we did in our previous workshops , and add to each one an new event handler :
1

Now , we will be working on the code behind of each event handler we already created , let’s start with the first one which is the Adress Chooser  :

This choosers will help us find the adress of each contact we have in our Windows Phone in order to use it inside your application for another feature , of course the contact you have chosen have to be a contact that already written his adress into his account , of course we will need the namespace of Tasks like we did in the workshop of launchers :
We will create an object of type AdressChooserTask and a new event to show in a MessageBox what’s the contact you have chosen
2

Let’s move now to the next chooser which is the camera capture . For example if you want to add a feature of taking a picture inside your application you will need to use this chooser to give the user a simple way to open the camera without leaving the application , we will create an object of type CameraCaptureTask :
3

Another important Chooser is the Email Chooser , you will be able to give your user the ability to choose an email of a contact in order to send him an email via the application for example , we will use now an object of type EmailAddressChooserTask :
4


Let’s move to the last chooser of our workshop which is the Phone Number chooser , your user can choose a contact and find its number ( if it’s added of course ) and use inside the application , our object now will be a PhoneNumberChooserTask :
5

There are other choosers that might be helpful for you in your application but I’ve chosen these one because they are the most common ones and we will use them in our next workshop to develop our first applicaiton together . You can find other choosers in MSDN here in this link .
Please note that the Camera chooser will not work on the emulator of course . Here are some screenshots of our workshop tested on a Nokia Lumia 920 :
wp_ss_20140215_0015[1]


wp_ss_20140215_0016[1]

wp_ss_20140215_0018[1]

wp_ss_20140215_0019[1]

wp_ss_20140215_0019[1]

No comments:

Post a Comment