Introduction



Home Screen :

Name of Experiment : Cellular Info (includes information related to Network Operator, Network Availability, Cellular Data Enabled, Cellular Data Roaming Enabled, Wi-fi Enabled etc)

Exp No : MC3

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

Summary : It is always necessary to know certain information related to Network, in order to keep track of the resources being used by the device.

Learning Objective : Student can able to track the network resources being consumed by the device.

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. MC3" TextAlignment="Right" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock x:Name="ApplicationTitle" Text="Mobile Computing" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock x:Name="PageTitle" Text="Cellular Info" 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">
<StackPanel Orientation="Vertical">
<StackPanel Orientation="Horizontal" Height="64">
<TextBlock Text="IsNetworkAvailable:"/>
<TextBlock x:Name="txtNetwork" />
</StackPanel>
<StackPanel Orientation="Horizontal" Height="64"> <TextBlock Text="Operator:"/>
<TextBlock x:Name="txtOperator"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Height="64">
<TextBlock Text="IsCellularDataEnabled:"/>
<TextBlock x:Name="txtData"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Height="64">
<TextBlock Text="IsCellularDataRoamingEnabled:"/>
<TextBlock x:Name="txtRoamData"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Height="64">
<TextBlock Text="IsWifiEnabled:"/>
<TextBlock x:Name="txtWifi"/>
</StackPanel>
</StackPanel>
</Grid>
</Grid>



Exp No. MC3

Mobile Computing

Cellular info
MainPage.xaml.cs

using Microsoft.Phone.Controls;
using Microsoft.Phone.Net.NetworkInformation;
namespace CellInfo
{
public partial class Main2 :
PhoneApplicationPage
{
public Main2()
{
InitializeComponent();
txtNetwork.Text = DeviceNetworkInformation.IsNetworkAvailable.ToString();
txtOperator.Text = DeviceNetworkInformation.CellularMobileOperator.ToString();
txtData.Text = DeviceNetworkInformation.IsCellularDataEnabled.ToString();
txtRoamData.Text = DeviceNetworkInformation.IsCellularDataRoamingEnabled. ToString();
txtWifi.Text = DeviceNetworkInformation.IsWiFiEnabled.ToString();
}
}
}



Add Reference for Microsoft.Phone.Info

Snapshots





Observation

Observation : It is observed that Cellular Information is very much needed in order to save the resources in terms of economical and battery power.

Video Link

For Windows Phone

Download

Right Click Here And Select Save Target For Entire Download :

Cell Info Experiment