As we have seen in the previous chapters, the Windows Phone (WP) application architecture and application design differs from the Symbian Qt application architecture. Even though several similarities exist and many parts of existing work can be reused during transition from Symbian Qt C++ applications to WP C# applications, there are also some application areas where fundamental differences exist and/or comparisons between Symbian Qt C++ and WP C# are hard to express.
We try to address those areas by introducing a set of example applications that assist in binding Symbian Qt C++ and WP C# application development closer to each other. This chapter presents WP C# example applications on Application UI, device integration, networking and data management area. Full application code is provided to illustrate WP C# programming concepts on before-mentioned application areas, in addition to showcasing common structures of WP C# applications and topics introduced in the previous chapters.
Another purpose is to provide more practical-oriented approach to the transition from Symbian Qt C++ to WP C# application development. Ready-made example applications of good quality and covering several use cases show you the preferred way of implementing certain features in WP C# applications.
Windows Phone General Examples
The following table lists general purpose example applications for Windows Phone. These example application and starter kits demonstrate many essential features in WP application development.
This sample illustrates a technique for preserving and restoring UI and application state as the application is activated and deactivated by the operating system.
This starter kit demonstrates how to apply the Model-View-ViewModel design pattern in Windows Phone application, how to optimize application start up and how to create a context sensitive menu.
This starter kit demonstrates how to make Windows Phone application's color scheme match the user's theme choice, how to make Silverlight application interact realistically with the accelerometer of the phone and how to customize phone orientation sensing.
This starter kit demonstrates how to call a web service, how to use an XNA Framework API from within a Silverlight application to play a sound, how to maintain a history list in isolated storage and how to animate an image in aToggleButton.
Windows Phone Application UI Examples
The following table lists example applications from Windows Phone Code Samples demonstrating how to implement several WP application UI concepts.
This sample shows how to visualize, inspect and modify the navigation history, or back stack, of an application. This sample uses the newBackStackproperty and theRemoveBackEntry()method available in Windows Phone OS 7.1.
This sample enables you to dynamically test the differentApplicationBarproperties, such asOpacityandModeas well as different colors. This sample contains application bar code for a plain page, a pivot page and a panorama page.
This sample combines Silverlight and the XNA Framework into a single Windows Phone application. This sample demonstrates how to render Silverlight controls and text from the XNA Framework by using theUIElementRendererclass.
This sample demonstrates how to create, update and delete secondary Tiles. The Tile updates demonstrate how to update the properties on both the front and back of a Tile. The update techniques can also be applied to Application Tiles.
This sample demonstrates how to update a Tile using the Microsoft Push Notification Service. This sample contains two projects - one project for the client code that sets up the Windows Phone device to receive a notification and another project that sends the notification to the Microsoft Push Notification Service
This sample shows how to use the Scheduled Action Service to schedule and manage Reminders. Reminders are dialogs that pop up and display a message to the user at a time scheduled by the application that created them.
Windows Phone Device Integration Examples
The following table lists example applications from Windows Phone Code Samples demonstrating how applications can integrate with device hardware and platform.
This sample implements anAudioPlayerAgentthat allows audio to play even when the application is not in the foreground. This background agent will run under the lock screen where the user can control the audio using the universal volume control (UVC).
This sample demonstrates how to use theDeviceStatus, including accessing the properties of the class, to determine if the power source of the device has changed and to determine if a physical keyboard has been deployed.
This sample demonstrates how to activate the shutter and auto focus for camera, how to configure picture resolution and flash settings and how to use the hardware shutter button. This sample also demonstrates touch focus and a front-facing camera for the devices that support those features.
This sample demonstrates video preview, recording and playback. It uses theFileSinkclass to write video to isolated storage, from which the video can be played afterward.
This sample shows how to obtain data from the Compass, Accelerometer and Gyroscope sensors.
This sample shows how to use theMediaHistoryandMediaHistoryItemclasses to create a Music + Videos Hub application. It also uses the XNAMediaPlayerclass to control playback of music.
Windows Phone Data Management Examples
The following table lists example applications from Windows Phone Code Samples that demonstrate different data management scenarios.
This sample shows you how to use the Background Transfer Service to schedule and manage background file transfers.
This sample demonstrates how to access contacts and appointments, and display the details by using data-binding. It also demonstrates two different techniques for displaying contact photos.
On Windows Phone OS 7.1, you can use LINQ to SQL to store relational data in a local database that resides in your application's isolated storage container. This sample is a to-do list application that uses a multi-table local database. Items that appear in the list are added, updated and deleted from a local database, where they will persist between application launches
This sample demonstrates how to use the basic functionality of the Bing Maps Silverlight Control for Windows Phone.
This sample application receives data from the Microsoft Location Service and displays geographic coordinates of the device.
Search Extras are a new way for applications to seamlessly extend the Search experience on Windows Phone. Learn how to integrate your application with search result item cards. This sample is a fictitious product recall application that you can launch from the extras pivot page of an item card from a product search. If you do not have a Windows Phone OS 7.1 device, edit theDefaultTaskelement in the application manifest to simulate a Search Extras call in the emulator.
Windows Phone Networking Examples
The following table introduces two example applications from Windows Phone Code Samples demonstrating multicast group communication and use of sockets.
This sample demonstrates how to communicate over a multicast group in a Windows Phone application. It implements the classic Rock Paper Scissors game. Players join a multicast group to discover each other. UDP unicasting is then used to challenge a player and play the actual game. TheUdpAnySourceMulticastClientclass available in Windows Phone OS 7.1 is used in this sample.
This sample demonstrates the use of sockets in a Windows Phone application to communicate with a service hosted on the network. It uses the newSystem.Net.Socketsclass available on Windows Phone.
In this chapter we took a look at several types of Windows Phone example applications. Lots of essential functionality, features and use cases within Application UI, device integration, data management and networking areas were covered with these sample applications.
To know more about the example applications and get started with application development for Windows Phone, visit:
Other Resources you may find useful: