Exercise 5: Testing the Windows Phone 7 Application

In this exercise, you will test the Windows Phone 7 application.

Note:
Note: This lab requires the firewall be turned off to enable connection to the Push Notification Service.

Note:
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.

  1. In the WP7.Notification.Events.PhoneApp project, select Windows Phone 7 Emulator in the deployment location dropdown list.
  2. In the Solution Explorer, right click the WP7.Notification.Events solution and select Properties.
  3. Select Multiple startup projects.
  4. Set the action for EventNotification to Start.
  5. Set the action for NotificationRegistration to Start.
  6. Set the action for WP7.Notification.Events.PhoneApp to Start.
  7. Click OK.
  8. In the WP7.Notification.Events solution, press F5.
  9. 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.

  1. In the WP7.Notification.Events solution, press F5, if the application is not running.
  2. 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.
  3. Click the Settings icon.

    Figure 14

    Settings icon on main page

  4. Click Enable Notification checkbox.

    Figure 15

    Application’s settings page

  5. Click the phone’s back arrow button to return to the application’s main page.
  6. Click the phone’s back arrow button to return to the tile page.
  7. Click the Arrow icon in the top-right corner to display the list of applications.

    Figure 16

    Icon to the list of applications

  8. 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

  9. Click pin to start.

    Figure 18

    Application tile pinned to the start page

  10. 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.
  11. 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

  12. Save the new calender event.
  13. Verify the tile count displays 1in the emulator.

    Note:
    Note: The notification may not display immediately.

    Figure 20

    Display the toast notification on the start page

  14. Click the application tile to open the application.

    Figure 21

    Clicking the tile opens the application

  15. Click the phone’s back button to verify the tile count is now blank or zero.

    Figure 22

    Application tile is now blank