Taking a Photo with the CameraCaptureTask

The camera capture task is a chooser that is used to launch the built-in Camera app. If the user completes the task by taking and confirming a photo, the Completed event is raised and the event handler receives a PhotoResult object, which exposes a stream containing the image data.

For information on working with photo image streams, see Chapter 20, “Extending the Windows Phone Picture Viewer.”

The CameraCaptureTask should be defined as a field in your class, like so:

readonly CameraCaptureTask cameraCaptureTask                                     = new CameraCaptureTask();

Subscribe to the CameraCaptureTask.Completed event within your class constructor, as shown:

Get Windows® Phone 8 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.