Share via


Método Platform.GetDevice

Obtém um Device dada sua ID.

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

Sintaxe

Public Function GetDevice ( _
    deviceId As ObjectId _
) As Device

Dim instance As Platform
Dim deviceId As ObjectId
Dim returnValue As Device

returnValue = instance.GetDevice(deviceId)
public Device GetDevice(
    ObjectId deviceId
)
public:
Device^ GetDevice(
    ObjectId^ deviceId
)
public function GetDevice(
    deviceId : ObjectId
) : Device

Parâmetros

Valor de retorno

Tipo: Microsoft.SmartDevice.Connectivity.Device
Um objeto de dispositivo que representa o dispositivo.

Exceções

Exceção Condição
ArgumentNullException

Quando o argumento de entrada é uma seqüência de caracteres nula.

DeviceNotFoundException

Quando um dispositivo com a ID de dispositivo especificado não foi encontrado.

Exemplos

' 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"));

Permissões

Consulte também

Referência

Platform Classe

Membros Platform

Namespace Microsoft.SmartDevice.Connectivity