Home > Programming Language > Writing A Windows Phone 7.5 Camera Application

Writing A Windows Phone 7.5 Camera Application

( Full Size Image )
Figure 1: Create a new Windows Phone focus project

When stirred to choose the aim Windows Phone OS version,select Windows Phone OS 7.1 as shown below.

( Full Size Image )
Figure 2: Select the aim Windows Phone OS version

Add anxiety to Microsoft.Xna.Framework from the list ofavailable components in the Add Reference Dialog.

( Full Size Image )
Figure 3: Add anxiety to Microsoft.Xna.Framework

Add a couple of buttons on the MainPage called Start andClick.

Also, increase a Canvas patrician CameraView, that will representthe ViewFinder shade in our application.

The XAML:

Note that you will increase click events is to buttons after that onin the exercise.

In the code-behind record for MainPage (MainPage.xaml.cs), addthe subsequent to using statements, that you would must be access, to createvariables.

Now, increase variables for a camera and Media Library in theMainPage.xaml.cs.

In the constructors of the MainPage, instantiate themediaLibrary object.

Now, you will increase ethics is to click events is to buttonswe updated above.

Double click the “Start Camera” symbol and increase the followingcode to the eventuality handler generated.

Here is what you did. The subsequent to line instantiated thecamera.

We then updated eventuality handlers is to events of fascination onthe camera, namely, Capture finished and Capture picture available.

Lastly, you see the viewfinder source to the camera. Thiswill enable us to see what the camera is saying when you beginning the camera.

Now, you will go forward and exercise the Capture symbol clickevent.

The on top of function is self-explanatory. We only inquire thecamera intent to takeover the picture if it is instantiated.

Now, if you endeavor to put together your ethics at this point, youwill obtain errors since the camera_CaptureCompleted andcamera_CaptureImageAvailable methods are not present.

We can use the Camera_CaptureCompleted eventuality handler toupdate the position of our print fire event. It is willing to help to the user to know whetherhe/she clicked the fire symbol successfully or not.

Add a textbox on the Page called textBoxStatus and updatethe content on the textbox to uncover that the takeover was completed.

We must be stock the picture in to the media library. Wewill use the CaptureImageAvailable eventuality handler for this.

Now you can put together and govern our initial Windows PhoneCamera application.

Note that in the emulator, there is no encouragement for a virtualcamera (the focus will govern but you can’t see anything) so you arebetter off perplexing this on your Windows Phone.

If you are having problems subsequent to along, you can downloadthe representation ethics is to exercise below.

In this article, you schooled the essentials about Windows Phonecamera and how to emanate a Windows Phone application, that utilizes the camerathrough APIs. I hope you have found this data useful.







Categories: Programming Language Tags:

  1. No comments yet.