private void tmrUpdate_Tick(object sender, EventArgs e)
{
bool bSelected = false, bDisconnect = false, bPair = false;
lblHost.Text = rootHub.Dongle;
lblHost.Enabled = btnStop.Enabled;
for (var index = 0; index < Pad.Length; index++)
{
Pad[index].Text = rootHub.Pads[index].ToString();
Pad[index].Enabled = rootHub.Pads[index].State == DsState.Connected;
Pad[index].Checked = Pad[index].Enabled && Pad[index].Checked;
bSelected = bSelected || Pad[index].Checked;
bDisconnect = bDisconnect || rootHub.Pads[index].Connection == DsConnection.Bluetooth;
bPair = bPair ||
(Pad[index].Checked && rootHub.Pads[index].Connection == DsConnection.Usb &&
rootHub.BluetoothHostAddress != null
&& !rootHub.BluetoothHostAddress.Equals(rootHub.Pads[index].HostAddress));
}
btnBoth.Enabled = btnLeft.Enabled = btnRight.Enabled = btnOff.Enabled = bSelected && btnStop.Enabled;
btnPair.Enabled = bPair && bSelected && btnStop.Enabled && rootHub.Pairable;
btnClear.Enabled = lvDebug.Items.Count > 0;
}