Start your free trial now, and begin learning software, business and creative skills—anytime, anywhere—with video instruction from recognized industry experts.

Start Your Free Trial Now

Work with the camera Windows Phone SDK

Working with the camera provides you with in-depth training on Developer. Taught by Michael Lehman a… Show More

Windows Phone SDK Essential Training

with Michael Lehman

Video: Work with the camera Windows Phone SDK

Working with the camera provides you with in-depth training on Developer. Taught by Michael Lehman as part of the Windows Phone SDK Essential Training
Expand all | Collapse all
  1. 2m 35s
    1. Welcome
    2. What you need to know to take this course
    3. Using the exercise files
  2. 15m 45s
    1. Downloading and installing the Windows Phone tools
      2m 44s
    2. Creating a Hello World application
      9m 32s
    3. Debugging on a Windows Phone device
      3m 29s
  3. 6m 29s
    1. Exploring device capabilities
      2m 58s
    2. Understanding the Emulator
      3m 31s
  4. 8m 51s
    1. Understanding the SDK
      8m 51s
  5. 41m 32s
    1. Introducing the converter
      3m 36s
    2. Creating the user experience (UX)
      13m 35s
    3. Responding to the Application Bar
      2m 40s
    4. Implementing click handlers
      3m 52s
    5. Saving and loading settings
      8m 18s
    6. Preparing your app for shipment
      9m 31s
  6. 20m 49s
    1. Introducing sonnets
      1m 38s
    2. Data binding with Silverlight
      4m 4s
    3. Exploring the Model-View-ViewModel pattern (MVVM)
      4m 3s
    4. Implementing the Master-Detail pattern using pages
      3m 53s
    5. Loading external data
      7m 11s
  7. 50m 27s
    1. Choosing a multipage controller
      3m 13s
    2. Preparing for persistence
      7m 30s
    3. Updating the data model
      7m 2s
    4. Creating the details page
      4m 30s
    5. Bringing it all together
      3m 58s
    6. Cloning a Windows Phone app
      6m 49s
    7. Using SQL CE
      8m 49s
    8. Updating the data model
      2m 24s
    9. Querying and updating the database
      6m 12s
  8. 14m 19s
    1. Working with the camera
      6m 11s
    2. Exploring GPS
      5m 21s
    3. Exploring the accelerometer
      2m 47s
  9. 29m 35s
    1. Introducing recording and playback with XNA
    2. Capturing sound
      5m 12s
    3. Providing feedback while recording
      5m 50s
    4. Playing a recording
      4m 34s
    5. Persisting a recording
      2m 58s
    6. Listing recordings
      5m 15s
    7. Managing the recording list
      3m 26s
    8. Recording under the lock screen
      1m 35s
  10. 28m 32s
    1. Building the UX
      3m 54s
    2. Using WebClient
      4m 1s
    3. Determining network connectivity
      2m 9s
    4. Leveraging Internet Explorer
      7m 56s
    5. Adding a live tile
      2m 42s
    6. Building a background agent
      7m 50s
  11. 14m 46s
    1. Hello World in C++
      4m 35s
    2. Libraries
      4m 17s
    3. Managed plus managed
      5m 54s
  12. 26m 36s
    1. Exploring built-in controls
      4m 28s
    2. Windows Phone Toolkit
      2m 42s
    3. Introducing Coding4Fun
      3m 14s
    4. Reminders and notifications
      6m 10s
    5. Wallet and In-App Purchase
      1m 34s
    6. File and protocol associations
      1m 59s
    7. Bluetooth
    8. Integrating speech
      1m 28s
    9. Near field communication (NFC)
      1m 23s
    10. WinRT and legacy Windows Phone APIs
      2m 54s
  13. 12m 15s
    1. Publishing your apps
      2m 49s
    2. Learning from apps in the Windows Phone Marketplace
      1m 23s
    3. Staying in touch with updates and new information from Microsoft
      2m 34s
    4. Looking at Windows Phone 7 app reviews
    5. Exploring web sites books and other useful links
      4m 45s
  14. 1m 34s
    1. Farewell
      1m 34s

please wait ...
Working with the camera
Video Duration: 6m 11s 4h 33m Beginner


Working with the camera provides you with in-depth training on Developer. Taught by Michael Lehman as part of the Windows Phone SDK Essential Training

View Course Description

Discover how to build professional apps that encompass the 17 major feature areas of Windows Phone, from XAML to multimedia to network access. In this course, author Michael Lehman details the standard hardware device configuration, teaches how to navigate the development environment, and explores the Windows Phone APIs. The course shows how to build sample applications while learning Windows Phone concepts and frameworks, including the Metro design language.

Topics include:
  • Downloading and installing the tools
  • Understanding the SDK
  • Designing the user experience (UX)
  • Implementing commands
  • Data binding with Silverlight
  • Exploring the Model-View-ViewModel (MVVM) pattern
  • Loading external data
  • Capturing data from the camera, GPS, compass, and accelerometer
  • Recording and playing sound
  • Implementing persistence with isolated storage
  • Leveraging built-in tasks, choosers, and launchers
  • Expanding the available controls using the Silverlight and Coding4Fun toolkits
  • Cloning a Windows Phone app
  • Learning how to publish your app
Windows Phone

Working with the camera

Every Windows phone device has sensors to be able to capture the world around you. There are one or more image sensors which enables implementation of a camera capability. A GPS radio which implements location awareness capability. And an accelerometer, which enables you to determine when the device is actually physically moving in 3D space. So let's look at how you use each one of these three capabilities in order. First we'll take a look at our sample application, then we'll dig into the code. So first of all, let's look at the camera. The camera is connected in your code to something called the Camera Task.

And we launch it, the camera shows up. Now, in the Windows Phone Emulator, all you see in the sample camera user experience is this little square moving around. And buttons here at the bottom to simulate whether or not you've got the flash, whether you're connected to the front or rear camera. And whether you're capturing video or still pictures. because there's no camera actually connected to the emulator. When you click on the camera it takes a simulated picture, and then pops up these buttons. To allow you to decide whether you want to accept or retake the picture. When you click Accept, you get a white square with a colored square inside it, depending upon the little image was moving around the square.

When the camera actually, took the picture. Next up, let's take a look at the GPS. And we can start tracking the location. The way we set the location is by using this additional Tools fly-out and clicking on Location. Let's pick Seattle, click right there. Now we click Start Tracking Location. We can see the longitude, latitude and the accuracy within meters. We can also change the location over here, so for example, if we want to say, let's go look at London, we click here, and track location again. Now you can see we're at latitude nearly zero, longitude 51, and again an accuracy of five meters.

We've also hooked up the Maps task here, because In Windows Phone 8, it's incredibly easy to take a GPS coordinate and map it. So let's click the Map It button. Now you're going to get the full-on system mapping capability of Windows Phone without having to write more than about four lines of code in your app. Because it's a privacy consideration, you get this popup that says, will you allow Maps to access your location. We'll say yes, and you can see now we have a Windows Phone map which is actually quite a bit more detailed than this big map of exactly where we clicked over here in London. Finally in our Sensors app, there's an accelerometer where we can track the X Y and Z position of the device.

Over here in the additional tools, there's a simulated accelerometer that allows you to move the device around in 3D space. We can click Start Tracking and as we do. As we move the device around you can see the numbers over here on the left change. For example, this is y almost straight up, I can get it completely y to zero. But if I have the device face down or completely face up. You can see how that moves. There are some prerecorded data for the accelerometer, such as Shake.

So if I play that, you'll see the numbers over these change rapidly because it's simulating the user actually shaking the device. So that's the sample app. Now let's dig into the code behind the Camera task launcher. So we've fired up Visual Studio, and we're going to take a look at the sample implementation of the camera, GPS, and accelerometer that we just watched in the demo. To start with what we have, just the main page with three buttons. Each of those simply launches the camera, GPS, or accelerometer page.

Take a look at the code there. You can see that each one of those simply has a call to NavigationService.Navigate to go off to the proper page. Let's take a look at the camera page. The camera page consists of two controls, a button to launch the camera task, and an image control to display the result you get back from taking the picture. So we take a look at the code behind this. The key thing is to make sure that you bring in Microsoft.Phone.Tasks. This is how you get to the Camera Task. In the constructor, we instantiate a new instance of the Camera task and we also use this PhotoResult EventHandler.

For when the camera takes the picture so that we can capture the image. In our button handler, we simply call CameraCaptureTask.Show. And just for good measure, we cache invalid operation exception in that rare case where you might someday find a Windows Phone device with no camera. In the cameraCaptureTask_Completed handler, we look to see whether the photo result says the task result is okay. Meaning the user actually took the picture, and if it did, we create a BitmapImage.

And then we set the source of that bitmap to the chosen photo property of the photo result from the camera. And then set the image source of our image bitmap, image1, to the bitmapImage object we just created. Now, if you want to see this in action, you can use the emulator, or you can actually connect up a device. And unlike Windows Phone 7, Windows Phone 8 now allows you to debug your camera applications with a live device. So that if you take a picture on the camera, you actually will be able to see the result, and debug the output in Visual Studio.

Now, Microsoft also has sample code that allows you to access the raw camera data. So that if you wanted to create an augmented reality-type app, or things which implement custom zoom features. Or things which require raw access to the camera sensor or the flashlight, you can dig into that at a much deeper level. Windows Phone 8 has additional camera API's. You can create custom lenses. There is new API's for getting a preview image for getting a path to where your image is stored for sharing your media with social networks. And you can also adjust the exposure, focus, and white balance as well as get access to the uncompressed photo data.

Which is something you couldn't do on Windows Phone 7. Windows Phone 8 allows you to integrate into the photo viewer and photo edit picker as well. Now let's go on and take a look at the GPS

Find answers to the most frequently asked questions about Windows Phone SDK Essential Training .

Expand all | Collapse all
please wait ...
Q: This course was updated on June 10, 2013. What changed
A: This course was updated on June 10, 2013. Revisions include:
  • Over two dozen movies revised to reflect changes to Windows Phone 8 (released October 2012)
  • New instructions for downloading and installing to Windows Phone toolset
  • New instructions for working with Windows Phone 8 device data
  • New chapter on native development with C++
  • New chapter on advanced Windows Phone features including in-app purchasing with Wallet, reminders and notifications, Near Field Communication (NFC), and more.





Don't show this message again
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.

Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ .

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

* Estimated file size

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.

Mark all as unwatched Cancel


You have completed Windows Phone SDK Essential Training.

Return to your organization's learning portal to continue training, or close this page.


Upgrade to View Courses Offline


With our new Desktop App, Annual Premium Members can download courses for Internet-free viewing.

Upgrade Now

After upgrading, download Desktop App Here.

Become a Member and Create Custom Playlists

Join today and get unlimited access to the entire library of online learning video courses—and create as many playlists as you like.

Get started

Already a member?

Log in

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

You started this assessment previously and didn’t complete it.

You can pick up where you left off, or start over.

Resume Start over

Learn more, save more. Upgrade today!

Get our Annual Premium Membership at our best savings yet.

Upgrade to our Annual Premium Membership today and get even more value from your subscription:

“In a way, I feel like you are rooting for me. Like you are really invested in my experience, and want me to get as much out of these courses as possible this is the best place to start on your journey to learning new material.”— Nadine H.

Thanks for signing up.

We’ll send you a confirmation email shortly.

Sign up and receive emails about and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from

Sign up and receive emails about and our online training library:

Here’s our privacy policy with more details about how we handle your information.

submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.