private void btnConnect_Click(object sender, EventArgs e) { _relays = new UsbRelays(); // Populate the Device Count tbDeviceCount.Text = _relays.DeviceCount.ToString(); // Open each device foreach (string device in _relays.DeviceSerialNumbers) { _relays.OpenDevice(device); } // Populate the relay check Boxes CreateRelayCheckBoxes(); // Populate the USB Relay Devices Drop Down cbDevices.DataSource = _relays.DeviceSerialNumbers; // Add the combo box idex changed event // Have to do it here to ensure everything is created and ready to go. cbDevices.SelectedIndexChanged += cbDevices_SelectedIndexChanged; }
private static void ConnectToRelays() { _relays = new UsbRelays(); // Populate the Device Count _relays.DeviceCount.ToString(); // Open each device foreach (string device in _relays.DeviceSerialNumbers) { _relays.OpenDevice(device); } // Populate the relay check Boxes CreateRelayCheckBoxes(); // Populate the USB Relay Devices Drop Down Console.WriteLine("Serial Numbers"); foreach (string deviceSerialNumber in _relays.DeviceSerialNumbers) { Console.WriteLine(" " + deviceSerialNumber); } Console.WriteLine(); }