Introduction



Home Screen :

Name of Experiment : Send an SMS

Exp No : MC6

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

Summary : Sending SMS is an in-built functionality of the mobile device. But, sometimes we require this activity through your own 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
<!--LayoutRoot is the root grid where all page content is placed-->
<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 MC6" TextAlignment="Right" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock x:Name="ApplicationTitle" Text="Mobile Computing" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock x:Name="PageTitle" Text=" Sms" 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="Send SMS " Height="72" HorizontalAlignment="Left" Margin="12,154,0,0" Name="button1" VerticalAlignment="Top" Width="438" Click="button1_Click" />
</Grid>
</Grid>










 Exp No MC6(Experiment title)

 Mobile Computing(Application title)

 Sms(Page title)



 Send SMS (Button Content)
MainPage.xaml.cs
using System;
using System.Windows;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Tasks;

namespace SmsTask
{
public partial class MainPage : PhoneApplicationPage
{
PhoneNumberChooserTask _numberchooser;
SmsComposeTask _smschooser;
// 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) {
_smschooser = new SmsComposeTask();
_smschooser.To = e.PhoneNumber;
_smschooser.Show();
}
}

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


 Microsoft.Phone.Tasks






 Initialise PhoneNumberChooserTask SmsComposeTask

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 :

Send an SMS Experiment