gray laptop computer showing html codes in shallow focus photography

How to get DeviceName and ManufacturerName of Windows Phone device using C#?

In one of my earlier posts, I talked about How to get the UniqueID of the Windows Phone device using C# ?, the Developers can also use the same class “DeviceExtendedProperties” defined in the assembly Microsoft.Phone.Info to retrieve the DeviceName and the ManufacturerName too.

How to get DeviceName and ManufacturerName of Windows Phone device using C#?

Below is a sample code that lets you retreive the DeviceName and the ManufacturerName which again uses the extended device property lists “DeviceManufacturer” and “DeviceName” .

private void button1_Click(object sender, RoutedEventArgs e)
{
     string modelname = null;
     object modelobject = null;
     if (Microsoft.Phone.Info.DeviceExtendedProperties.TryGetValue("DeviceName", out modelobject))
      modelname = modelobject as string;
     string ManufacturerName="";
     object manufacturerobject;
     if (DeviceExtendedProperties.TryGetValue("DeviceManufacturer", out manufacturerobject))
      ManufacturerName = manufacturerobject.ToString();
     MessageBox.Show("Device Name = " + modelname + " Manufacturer = " + ManufacturerName );
}

When the above example is run on emulator , the DeviceName will be XDeviceEmulator and the Manufacturer will be Microsoft .

Leave A Reply

Your email address will not be published. Required fields are marked *

You May Also Like

In this post, you’ll learn about the Win32 Error “0x000019E5 – ERROR_COULD_NOT_RESIZE_LOG” that you get when debugging system erors in...
In this post, you’ll learn about the error “CO_E_DBERROR 0x8004E02B” that is returned when working with COM based APIs or...
In this post, you’ll learn about the Win32 Error “0x000019D0 – ERROR_LOG_BLOCK_VERSION” that you get when debugging system erors in...