26.8.txt
来自「《Microsoft Visual C# .NET 2003开发技巧大全》源代码」· 文本 代码 · 共 22 行
TXT
22 行
Listing 26.8 Device Discovery Using Infrared
private void mnuDevInfo_Click(object sender, System.EventArgs e)
{
IrDAClient client = new IrDAClient();
IrDADeviceInfo[] devices = client.DiscoverDevices(10);
foreach( IrDADeviceInfo device in devices )
{
AddMessage( “Found”, “DeviceID = “ + FormatDeviceID(device.DeviceID) +
“ DeviceName: “ + device.DeviceName +
“ Hints: “ + device.Hints.ToString() );
}
}
private string FormatDeviceID( byte[] deviceID )
{
string ret = “0x”;
for( int i = 0; i < 4; i++ )
{
ret += Convert.ToInt32(deviceID[i]).ToString(“X”);
}
return ret;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?