Introduction
Many a times, your application would require to access the contacts of the user. Fortunately, the Windows Phone Emulator provides you with a few dummy contact entries which you can access.
But these contacts are bare bones and they don't feature data like photo, birthday, anniversary, personal address and so on.
If you are a Windows Phone 7 Developer, you must have used the Emulator some or the other time. If you remember well, you will not have seen these screens before on the emulator. The only icon which shows up when you fire up the Emulator is of Internet Explorer. On clicking the right arrow, you get a list of Your application (if deployed), Internet Explorer, Settings.
I am not sure why Microsoft did not put up the People Hub Tile on Windows Phone Emulator but there is a workaround of invoking it and do whatever changes you need. You can even add contacts, link with accounts for Windows Live, Gmail, Outlook, Facebook and others.
Using the Code
Create a New Windows Phone Application project in Visual Studio. On MainPage, just add a Button and double click on the Button which will create a Click Event Handler for the Button.
In the Code View, find the event handler (it should be named as button1_Click
or such) and type this code.
PhoneCallTask task = new PhoneCallTask();
task.PhoneNumber = "000000000";
task.DisplayName = "Test user";
task.Show();
You would need to add a Using
statement for Microsoft.Phone.Tasks
. Press Ctrl + F5 to start the project.
What we are doing here is initiating a phone call (don't worry, you won't get charged as the Emulator uses Fake GSM). Once your phone is connected and a timer starts counting your call seconds…
…click on “add call” button which will put your call on Hold and show you a screen with options to dial another number.
In the Application Bar at the bottom, click the third button with Diary icon which will fire up your People Hub for you to tinker around with.
You can now click on the Status Bar at the top and end the call. Don't worry, it won't close down the People Hub. Once you ended the call, the emulator will return to People Hub screen for you to tinker around with. You can make changes to the default contacts, create your own contacts, link with accounts such as Windows Live, Outlook, Gmail, etc.
Once you link an account say Gmail, you can even read mails from here.
History
- 26th November, 2011: Initial post