Platform.GetDevice メソッド
更新 : 2007 年 11 月
指定した ID に対応する Device を取得します。
名前空間 : Microsoft.SmartDevice.Connectivity
アセンブリ : Microsoft.SmartDevice.Connectivity (Microsoft.SmartDevice.Connectivity.dll 内)
構文
'宣言
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
パラメータ
deviceId
型 : Microsoft.SmartDevice.Connectivity.ObjectIdデバイスの ID を表すオブジェクト。
戻り値
型 : Microsoft.SmartDevice.Connectivity.Device
デバイスを表すデバイス オブジェクト。
例外
例外 | 条件 |
---|---|
ArgumentNullException | 入力引数が null 文字列の場合。 |
DeviceNotFoundException | 指定されたデバイス ID を持つデバイスが見つからない場合。 |
例
' 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"));
アクセス許可
- 直前の呼び出し元に対する完全な信頼。このメンバは、部分的に信頼されているコードから使用することはできません。詳細については、「部分信頼コードからのライブラリの使用」を参照してください。