private void checkBoxAll_CheckedChanged(object sender, EventArgs e) { if (_usbI2C.IsOpen()) { var relays = new ere_I2C_RL8xxM(_usbI2C, 0); if (checkBoxAll.Checked) { _setRelayState(ere_I2C_RL8xxM.Relay.ALL, checkBoxAll.Checked); checkBoxK1.Checked = true; checkBoxK2.Checked = true; checkBoxK3.Checked = true; checkBoxK4.Checked = true; checkBoxK5.Checked = true; checkBoxK6.Checked = true; checkBoxK7.Checked = true; checkBoxK8.Checked = true; } else { _setRelayState(ere_I2C_RL8xxM.Relay.ALL, checkBoxAll.Checked); checkBoxK1.Checked = false; checkBoxK2.Checked = false; checkBoxK3.Checked = false; checkBoxK4.Checked = false; checkBoxK5.Checked = false; checkBoxK6.Checked = false; checkBoxK7.Checked = false; checkBoxK8.Checked = false; } } }
// // ere I2C RL8xxM... // private void _setRelayState(ere_I2C_RL8xxM.Relay relay, bool state) { if (_usbI2C.IsOpen()) { var relays = new ere_I2C_RL8xxM(_usbI2C, _ere_I2C_RL8xxM_config); UsbI2C.StatusResults statusResults; if (state) { statusResults = relays.On(relay); } else { statusResults = relays.Off(relay); } _displayError(statusResults); } }