void RemoveDevice(IDeckLink decklinkDevice) { // Stop capture if the selected device was removed if (m_selectedDevice != null && m_selectedDevice.deckLink == decklinkDevice) { if (m_selectedDevice.isCapturing) { StopCapture(); } comboBoxInputDevice.SelectedIndex = -1; m_selectedDevice = null; } // Remove the device from the dropdown comboBoxInputDevice.BeginUpdate(); foreach (StringObjectPair <DeckLinkDevice> item in comboBoxInputDevice.Items) { if (item.value.deckLink == decklinkDevice) { comboBoxInputDevice.Items.Remove(item); break; } } comboBoxInputDevice.EndUpdate(); if (comboBoxInputDevice.Items.Count == 0) { buttonStartStop.Enabled = false; EnableInterface(false); } }
void AddDevice(IDeckLink decklinkDevice) { DeckLinkDevice deckLink = new DeckLinkDevice(decklinkDevice); if (deckLink.deckLinkInput != null) { comboBoxInputDevice.BeginUpdate(); comboBoxInputDevice.Items.Add(new StringObjectPair <DeckLinkDevice>(deckLink.deviceName, deckLink)); comboBoxInputDevice.EndUpdate(); if (comboBoxInputDevice.Items.Count == 1) { comboBoxInputDevice.SelectedIndex = 0; EnableInterface(true); buttonStartStop.Enabled = true; } } }
private void comboBoxInputDevice_SelectedValueChanged(object sender, EventArgs e) { m_selectedDevice = null; if (comboBoxInputDevice.SelectedIndex < 0) { return; } m_selectedDevice = ((StringObjectPair <DeckLinkDevice>)comboBoxInputDevice.SelectedItem).value; // Update the video mode popup menu RefreshVideoModeList(); // Enable the interface EnableInterface(true); checkBoxAutodetectFormat.Checked = m_selectedDevice.supportsFormatDetection; }