How To Get The Selected Hardware Device From The Device Manager Skin
<< Back to the SharedPhidgets page
This is useful, when you want to use the DeviceManagerSkin to let users select a hardware device from the list :
// The DeviceManager skin
GroupLab.SharedPhidgets.DeviceManagerSkin deviceManagerSkin =
new GroupLab.SharedPhidgets.DeviceManagerSkin();
// The listview object
System.Windows.Forms.ListView listview =
deviceManagerSkin.GetListView();
// Now you can use the listview object...
listview.SelectedIndexChanged
+=new EventHandler(listview_SelectedIndexChanged);
System.Windows.Forms.ListView.SelectedIndexCollection collection =
this.listview.SelectedItems;
Alternatively, the DeviceSelection component can be used to select hardware devices by different means:
private void Create()
{
// Create DeviceSelection
GroupLab.SharedPhidgets.DeviceSelection deviceSelection =
new GroupLab.SharedPhidgets.DeviceSelection();
this.deviceSelection.SelectedDeviceChanged +=
new GroupLab.SharedPhidgets.SelectedDeviceEventHandler(
this.deviceSelection_SelectedDeviceChanged);
}
private void deviceSelection_SelectedDeviceChanged(object sender, GroupLab.SharedPhidgets.SelectedDeviceEventArgs e)
{
// ... here, add custom code
}
{
// Create DeviceSelection
GroupLab.SharedPhidgets.DeviceSelection deviceSelection =
new GroupLab.SharedPhidgets.DeviceSelection();
this.deviceSelection.SelectedDeviceChanged +=
new GroupLab.SharedPhidgets.SelectedDeviceEventHandler(
this.deviceSelection_SelectedDeviceChanged);
}
private void deviceSelection_SelectedDeviceChanged(object sender, GroupLab.SharedPhidgets.SelectedDeviceEventArgs e)
{
// ... here, add custom code
}