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