Windows Phone 7

Fetching Mobile Operator Name in Windows 7.1 Phone [Mango]

In this quick post I will show you,

How to fetch Mobile operator name in Windows 7 Phone?

Design the page

In content Grid, I have put a button. On click event of button, in message box we will display Mobile Operator Name

image

Write Code Behind

Add Namespace

clip_image001

On the click event of Button we will fetch operator name. Operator name can be fetched

clip_image003

Using calling CellularMobileOperator() function on DeviceNetworkInformation. After fetching , you can use it as string.

For your reference source code is as below,

MainPage.Xaml.cs


using System.Windows;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Net.NetworkInformation;

namespace MobileOperatorName
{
    public partial class MainPage : PhoneApplicationPage
    {

        public MainPage()
        {
            InitializeComponent();
            btnMobileOpeartor.Click += new RoutedEventHandler(btnMobileOpeartor_Click);
        }

        void btnMobileOpeartor_Click(object sender, RoutedEventArgs e)
        {
            string operatorName = "Mobile Opeartor : ";
            operatorName = operatorName + DeviceNetworkInformation.CellularMobileOperator.ToString();
            MessageBox.Show(operatorName);
        }

    }
}

Running the Application

Press F5 to run the application.

imageimage

I hope this post was useful. Thanks for reading Smile

About Dhananjay Kumar

Dhananjay Kumar is Developer, Blogger , Speaker, Learner , Mindcracker & Microsoft MVP.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 1,380 other followers

Tweets

Categories

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my current or previous employer's view in anyway. © Copyright 2012