private void LbDevices_DoubleClick(object sender, EventArgs e) { var listBox = sender as ListBox; if (listBox == null) { return; } _deviceItem = listBox.SelectedItem as DeviceItem; if (_deviceItem == null) { return; } tbCurrentDevice.Text = _deviceItem.Text; }
private void FillDeviceList(ListBox listBox) { listBox.DataSource = DeviceItem.GetDeviceItems(); listBox.DisplayMember = nameof(DeviceItem.Text); listBox.SelectedIndex = 0; }