Sunday, 25 January 2015

Windows Phone App Basics - 1

In this article we are going to see the basics of Windows Phone. Normally today Mobile phones are more widely used technology which is present in the  every person home. Mobile which means we can handle anything related to internet or computing process can be done with out the presence of computer. but all the things cant be done in the mobile, like we doing in computer. so now we start the basics of windows phone.

For create a successful app, First we have to understand the architect of a app.To develop a app, we need to knew that Windows Phone offers App in Two version 7 and 8,  now most of them stopped the developing the app for Version 7. It is recommended to develop a app for version 8, basically Both the versions are differs in many things.

Difference between the Windows Phone 7 and 8.

Windows Phone 7 Windows Phone 8
Screen size 800x480 800x480
orientation Portrait Portrait
Programming languages C#, Visual Basic, F# C#, Visual Basic
HTML5 + js  HTML5 + js 
DirectX (sans Direct2D)

Now there is a announcement soon about releasing Windows Phone 10.

Features in windows Phone 8.

1. Customize size of start screen
2. Location API
3. Maps
4. Wallet
5. Speech API
6. VoIP
7. Screen resolution

First we have to understand about the structure of Windows Phone Application.

Project structure:
1. App.Xaml :  
             which is the entry point of application. contains global resources, events, Life cycle.
2. WMAppManifest.Xaml : 
              which contains application deployment information - capabilities, icon, Task etc.
3. MainPage.Xaml :  
              which is the Design of application.

Application Structure:
Phone have two types of Views.
1. Panoramic 
2. Pivot

It is view which offers a unique way of views in Horizontal way, which extends beyond the windows phone screen.

It is a view which offers a view in Vertical Way, looks like Tab options.

Windows Phone have a system where we can place controls in the two way 
1. Application Bar
2. Menu Items

In Application bar we can add a 4 buttons up to as maximum, in Menu items we can add up to 5 menu items.

Above image explains the place of application bars and menu items in the windows phone.

Windows Phone supports multiple sensors, which can determine the motion of a device and orientation.Compass, Accelerometer, Gryoscope

Launchers and Choosers of  windows phone
Launcher and chooser are used to access the common device functionality, which is used to access the services of phone to use for there need , but there is a small difference in that. Launchers doesnt return the data, choosers return the data to the invoker.

some of the Launchers & Choosers

Now let we see some of them, First add the reference to the following namepsace.

 using Microsoft.Phone.Tasks;

Launch Media Player
Use the MediaPlayer use the MediaPlayer Launcher.

MediaPlayerLauncher mediaPlayer = new MediaPlayerLauncher();
mediaPlayer.Media = new Uri(@"", UriKind.Absolute);


Launch  camera Capture:
For Take a Photo we have to use the CameraCaptureTask, to set the result of the data in the Image use the Callback completed event.

CameraCaptureTask cameraCapture = new CameraCaptureTask();
cameraCapture.Completed += new EventHandler<PhotoResult>(cameraCapture_Completed);


        void cameraCapture_Completed(object sender, PhotoResult e)
            if (e.TaskResult == TaskResult.OK)
                BitmapImage bmp = new BitmapImage();
                image1.Source = bmp; 

Chooser PhotoChooser
For browse a photo from the Phone and place inside the application we have to use the PhotoChooserTask and bind the result an image control.

PhotoChooserTask PhotoChoosernew PhotoChooserTask();
PhotoChooser.Completed += PhotoChooser_Completed;



  void  PhotoChooser_Completed(object sender, PhotoResult e)
            if (e.TaskResult == TaskResult.OK)
                BitmapImage bmp = new BitmapImage();
                image1.Source = bmp; 

After choosen the photo

From the above you can learn some of the basics things in the Windows Phone apps.

No comments:

Post a Comment