Introduction



Home Screen :

Name of Experiment : Network Details (includes information related to Network such as Interface Type, Interface Subtype, Interface State, Interface Name, Description, Characteristics, Bandwidth etc )

Exp No : MC9

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

Summary : Network Speed, Interface name, Interface state, Interface type and Characteristics are few things which we would like to know about the network through which we are connected.

Learning Objective : This experiment displays, most of the details about the network, and student now get to know how they will handle the different network services using these details.

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" ShowGridLines="True" Background="Transparent" Height="768" Width="480">
<Grid.RowDefinitions>
<RowDefinition Height="168"/>
<RowDefinition Height="600*"/>
</Grid.RowDefinitions>

<!--TitlePanel contains the name of the application and page title-->
<StackPanel x:Name="TitlePanel" Margin="12,17,0,8">
<TextBlock x:Name="ExperimentTitle" Text="Exp No MC9" TextAlignment="Right" Style="{StaticResource PhoneTextNormalStyle}"/>

<TextBlock x:Name="ApplicationTitle" Text="Mobile Computing" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock x:Name="PageTitle" Text="Network Info" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
</StackPanel>

<!--ContentPanel - place additional content here-->

<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,20,12,0">
</Grid>

<Grid ShowGridLines="False" Height="617" HorizontalAlignment="Left" Margin="12,0,0,0" Name="grid1" VerticalAlignment="Top" Width="468" Grid.Row="1">

<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>

</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>

<TextBlock x:Name="txt1" Margin="20" Height="30" Grid.Row="0" Grid.Column="0" Text="Network Available" />
<TextBlock x:Name="tbNetwork" Margin="20" Height="30" Grid.Row="0" Grid.Column="1" />
<TextBlock x:Name="txt2" Margin="20" Height="30" Grid.Row="1" Grid.Column="0" Text="Cellular Operator"/>
<TextBlock x:Name="tbOperator" Margin="20" Height="30" Grid.Row="1" Grid.Column="1"/>
<TextBlock x:Name="txt3" Margin="20" Height="30" Grid.Row="2" Grid.Column="0" Text="Bandwidth"/>
<TextBlock x:Name="tbBandwidth" Margin="20" Height="30" Grid.Row="2" Grid.Column="1"/>
<TextBlock x:Name="txt4" Margin="20" Height="30" Grid.Row="3" Grid.Column="0" Text="Characteristics"/>
<TextBlock x:Name="tbCharacter" Margin="20" Height="30" Grid.Row="3" Grid.Column="1"/>
<TextBlock x:Name="txt5" Margin="20" Height="30" Grid.Row="4" Grid.Column="0" Text="Description"/>
<TextBlock x:Name="tbDescription" Margin="20" Height="30" Grid.Row="4" Grid.Column="1"/>
<TextBlock x:Name="txt6" Margin="20" Height="30" Grid.Row="5" Grid.Column="0" Text="Interface Name"/>
<TextBlock x:Name="tbInterName" Margin="20" Height="30" Grid.Row="5" Grid.Column="1"/>
<TextBlock x:Name="txt7" Margin="20" Height="30" Grid.Row="6" Grid.Column="0" Text="Interface State"/>
<TextBlock x:Name="tbInterState" Margin="20" Height="30" Grid.Row="6" Grid.Column="1"/>
<TextBlock x:Name="txt8" Margin="20" Height="30" Grid.Row="7" Grid.Column="0" Text="InterSubtype"/>
<TextBlock x:Name="tbInterSub" Margin="20" Height="30" Grid.Row="7" Grid.Column="1"/>
<TextBlock x:Name="txt9" Margin="20,0,0,10" Height="30" Grid.Row="8" Text="Interface Type"/>
<TextBlock x:Name="tbInterType" Margin="20,0,0,10" Height="30" Grid.Row="8" Grid.Column="1"/>

</Grid>

</Grid>











 Exp No MC9(Experiment title)

 Mobile Computing(Application title)


 Network Info(Page Title)



MainPage.xaml.cs
using System.Linq;
using System.Windows;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Net.NetworkInformation;

namespace Network_Info
{
public partial class MainPage : PhoneApplicationPage
{

public MainPage()
{
InitializeComponent();
Loaded += new RoutedEventHandler(test_Loaded);
}

public void test_Loaded(object sender, RoutedEventArgs e)
{
if (NetworkInterface.GetIsNetworkAvailable())
{

tbNetwork.Text = IsNetworkAvailable.ToString();
tbOperator.Text = CellularMobileOperator.ToString();

var allNetworks = (new NetworkInterfaceList()).ToList();
for (var i = 0; i < allNetworks.Count; i++)
{
var network = allNetworks.ElementAt(i);
tbBandwidth.Text = network.Bandwidth.ToString();
tbCharacter.Text = network.Characteristics.ToString();
tbDescription.Text = network.Description;
tbInterName.Text = network.InterfaceName;
tbInterState.Text = network.InterfaceState.ToString();
tbInterSub.Text = network.InterfaceSubtype.ToString();
tbInterType.Text = network.InterfaceType.ToString();

}
}
else { MessageBox.Show("No Network"); }
}
public static bool IsNetworkAvailable { get { return DeviceNetworkInformation.IsNetworkAvailable; } }

public static string CellularMobileOperator { get { return DeviceNetworkInformation.CellularMobileOperator.ToString(); } }

}
}


 Add Reference for Microsoft.Phone.Net.Network Information












 check whether the GSM Network is Available.

 Display the Network Operator
















 Setting the GeoCoordinate on the Map


 if Network is not available.

 overriding the methods

Snapshots


Observation

Observation : It is observe that using this experiment, all network related characteristics would be explored.

Video Link

For Windows Phone

Download

Right Click Here And Select Save Target For Entire Download :

Network Details - Experiment