Exercise 5: Testing the Windows Phone 7 Application
In this exercise, you will test the Windows Phone 7 application.
Note: This lab requires the firewall be turned off to enable connection to the Push Notification Service.
Note: Running this code in the emulator can cause a race condition when the project debugging has stopped but the emulator has not been shut down completely. The phone application will attempt to register before the service has completely started. To avoid this error simply disable notifications and re-enable notifications when the service has started or stop debugging in Visual Studio 2010, close the emulator and restart debugging. Another method to avoid this race condition is to start each project in the solution separately.
Task 1 – Testing the Application’s View Functionality in Windows Phone 7 Emulator
In this task, you will test the Windows Phone 7 application using the Windows Phone 7 emulator.
- In the WP7.Notification.Events.PhoneApp project, select Windows Phone 7 Emulator in the deployment location dropdown list.
- In the Solution Explorer, right click the WP7.Notification.Events solution and select Properties.
- Select Multiple startup projects.
- Set the action for EventNotification to Start.
- Set the action for NotificationRegistration to Start.
- Set the action for WP7.Notification.Events.PhoneApp to Start.
- Click OK.
- In the WP7.Notification.Events solution, press F5.
The Windows Phone application starts in the emulator and displays the items from the Maintenance Training Schedule SharePoint list. There will be no items in the list or application until we add items to the list. The SharePoint List Item event receiver is deployed and activated. The WCF service will start and display the WCF Test Client.
Figure 13
Application main page with no events displayed
Task 2 -Testing the Toast Notification in Windows Phone 7 Emulator
In this task, you will test the notification by enabling notifications and adding an item to the Maintenance Training Schedule list.
- In the WP7.Notification.Events solution, press F5, if the application is not running.
- The Windows Phone application and WCF Service start. The Event Receiver will deploy and activate. The emulator displays items from the Maintenance Training Schedule SharePoint list.
Click the Settings icon.
Figure 14
Settings icon on main page
Click Enable Notification checkbox.
Figure 15
Application’s settings page
- Click the phone’s back arrow button to return to the application’s main page.
- Click the phone’s back arrow button to return to the tile page.
Click the Arrow icon in the top-right corner to display the list of applications.
Figure 16
Icon to the list of applications
Left-click and hold the mouse button down on the Notify + Count application item in the list to display the menu items.
Figure 17
Pinning the tile to the start page
Click pin to start.
Figure 18
Application tile pinned to the start page
- Leave the emulator running and return to the web browser displaying the site with your list. Visual Studio will have opened a new browser window to the start site of the project.
Use Internet Explorer to navigate to the Maintenance Training Schedule list and enter a new training event. The training event data should be in the current month.
Figure 19
Creating a new training event in SharePoint 2010
- Save the new calender event.
Verify the tile count displays 1in the emulator.
Note: The notification may not display immediately.
Figure 20
Display the toast notification on the start page
Click the application tile to open the application.
Figure 21
Clicking the tile opens the application
Click the phone’s back button to verify the tile count is now blank or zero.
Figure 22
Application tile is now blank