Introduction



Home Screen :

Name of Experiment : Make a Call

Exp No : MC5

Background : Student should have a basic knowledge of C#.

Summary : Making Call is an in-built functionality of the mobile device. But, sometimes we require this activity through your own mobile App. Using this experiment you will get to know, how to add this functionality in your current Mobile App development.

Learning Objective : To learn the activity of making call through this experiment.

Target

Target Platform : This experiment is tested on Windows Phone Emulator and Nokia Lumia 800.

Procedure

SourceCode

Source Code : Comments :
MainPage.xaml
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!--TitlePanel contains the name of the application and page title-->
<StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
<TextBlock x:Name="ExperimentTitle" Text="ExpNo MC5" TextAlignment="Right" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock x:Name="ApplicationTitle" Text="Mobile Computing" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock x:Name="PageTitle" Text="Calling" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
</StackPanel>
<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<Button Content="Make Call" Height="72" HorizontalAlignment="Left" Margin="12,172,0,0" Name="button1" VerticalAlignment="Top" Width="438" Click="button1_Click" />
</Grid>
</Grid>








 Exp No MC5(Experiment title)

 Mobile Computing(Application title)

 Calling(Page title)
MainPage.xaml.cs
using System;
using System.Windows;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Tasks;

namespace CallingTask
{
public partial class MainPage : PhoneApplicationPage
{
PhoneNumberChooserTask _numberchooser;
PhoneCallTask _calling;
// Constructor
public MainPage()
{
InitializeComponent();
_numberchooser = new PhoneNumberChooserTask();
_numberchooser.Completed += new EventHandler<PhoneNumberResult>(_numberchooser_Completed);

}

private void _numberchooser_Completed(object sender, PhoneNumberResult e) {
if (e.TaskResult == TaskResult.OK) {
_calling = new PhoneCallTask();
_calling.DisplayName = e.DisplayName;
_calling.PhoneNumber = e.PhoneNumber;
_calling.Show();
}
}

private void button1_Click(object sender, RoutedEventArgs e)
{
_numberchooser.Show();
}
}
}


 Add Reference for Microsoft.Phone.Info






 PhoneNumberChooserTask
 PhoneCallingTask





 Calling Eventhandler



 define the event








 Handle the Button Click event

Snapshots





Observation

Observation : It is observed that we can use this experiment in different Mobile App development.

Video Link

For Windows Phone

Download

Right Click Here And Select Save Target For Entire Download :

Make a Call Experiment