Here is the code.
private wclBluetoothRadio GetSelectedRadio()
{
wclBluetoothRadio Result = null;
if (lvRadios.SelectedItems.Count == 0)
{
Result = new wclBluetoothRadio();
try
{
Result.API = wclBluetoothDiscovery.StringToBluetoothAPI(lvRadios.Items[0].SubItems[1].Text);
}
catch (Exception )
{
MessageBoxEx.Show(Resources.PlugAdaptorGR + ".Error code:201", headerMSG);
}
//MessageBox.Show("Select radio", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
else
{
Result = new wclBluetoothRadio();
try
{
Result.API = wclBluetoothDiscovery.StringToBluetoothAPI(lvRadios.SelectedItems[0].SubItems[1].Text);
}
catch
{
Result = null;
throw;
}
}
return Result;
}