Dela via


Platform.GetDefaultDeviceId Method

Gets the ID of the default device associated with this platform.

Namespace:  Microsoft.SmartDevice.Connectivity
Assembly:  Microsoft.SmartDevice.Connectivity (in Microsoft.SmartDevice.Connectivity.dll)

Syntax

'Declaration
Public Function GetDefaultDeviceId As ObjectId
'Usage
Dim instance As Platform 
Dim returnValue As ObjectId 

returnValue = instance.GetDefaultDeviceId()
public ObjectId GetDefaultDeviceId()
public:
ObjectId^ GetDefaultDeviceId()
public function GetDefaultDeviceId() : ObjectId

Return Value

Type: Microsoft.SmartDevice.Connectivity.ObjectId
ObjectId of the default device.

Remarks

You can use the return value to create an instance of Device by using GetDevice.

Examples

' Get the default device in the platform, usually an emulator. 
Dim device As Device = platform.GetDevice(platform.GetDefaultDeviceId())

' Output information about the device.
Console.WriteLine("Name:  " + device.Name + vbCr + vbLf + "Platform:  " & _
                  device.Platform.ToString() + vbCr + vbLf + "ID:  " + _
                  device.Id.ToString())

If device.IsEmulator() Then
    Console.WriteLine("Device is an Emulator")
End If 

' Output device properties
Console.WriteLine(vbCr + vbLf + "Device Properties:")
Console.WriteLine("    OS_Version: " + device.GetProperty("OS_Version"))
// Get the default device in the platform, usually an emulator.
Device device = platform.GetDevice(platform.GetDefaultDeviceId());

// Output information about the device.
Console.WriteLine("Name:  " + device.Name + "\r\n" +
                "Platform:  " + device.Platform + "\r\n" +
                "ID:  " + device.Id);

if (device.IsEmulator())
{
    Console.WriteLine("Device is an Emulator");
}

// Output device properties
Console.WriteLine("\r\nDevice Properties:");
Console.WriteLine("    OS_Version: " + device.GetProperty("OS_Version"));

.NET Framework Security

See Also

Reference

Platform Class

Platform Members

Microsoft.SmartDevice.Connectivity Namespace