private void GetAdapterInformation() { if (cbxAdapterType.SelectedIndex >= 0) { logger.Debug("ITrionic.GetAdapterNames selectedIndex=" + cbxAdapterType.SelectedIndex); string[] adapters = ITrionic.GetAdapterNames((CANBusAdapter)cbxAdapterType.SelectedIndex); cbxAdapterItem.Items.Clear(); foreach (string adapter in adapters) { cbxAdapterItem.Items.Add(adapter); logger.Debug("Adaptername=" + adapter); } try { if (adapters.Length > 0) { cbxAdapterItem.SelectedIndex = 0; } } catch (Exception ex) { logger.Debug(ex.Message); } } }
private void comboBoxEdit3_SelectedIndexChanged(object sender, EventArgs e) { if (cbAdapterType.SelectedIndex == (int)CANBusAdapter.COMBI || cbAdapterType.SelectedIndex == (int)CANBusAdapter.ELM327 || cbAdapterType.SelectedIndex == (int)CANBusAdapter.JUST4TRIONIC || cbAdapterType.SelectedIndex == (int)CANBusAdapter.MXWIFI) { btnAdapterConfiguration.Enabled = true; } else { btnAdapterConfiguration.Enabled = false; } if (cbAdapterType.SelectedIndex != -1) { string[] adapters = ITrionic.GetAdapterNames((CANBusAdapter)cbAdapterType.SelectedIndex); ComboBoxItemCollection collection = cbAdapter.Properties.Items; collection.BeginUpdate(); collection.Clear(); foreach (string adapter in adapters) { collection.Add(adapter); } collection.EndUpdate(); if (adapters.Length > 0) { cbAdapter.SelectedIndex = 0; cbAdapter.Enabled = true; } else { cbAdapter.SelectedIndex = -1; cbAdapter.Enabled = false; } } }