void RemoveDevice(IDeckLink decklinkDevice) { // Stop capture if the selected device was removed if (m_selectedDevice != null && m_selectedDevice.deckLink == decklinkDevice && m_running) { // Stop running and disable output, we will not receive ScheduledPlaybackHasStopped callback StopRunning(); DisableOutput(); } // Remove the device from the dropdown comboBoxOutputDevice.BeginUpdate(); foreach (StringObjectPair <DeckLinkOutputDevice> item in comboBoxOutputDevice.Items) { if (item.value.deckLink == decklinkDevice) { comboBoxOutputDevice.Items.Remove(item); break; } } comboBoxOutputDevice.EndUpdate(); if (comboBoxOutputDevice.Items.Count == 0) { EnableInterface(false); m_selectedDevice = null; } else if (m_selectedDevice.deckLink == decklinkDevice) { comboBoxOutputDevice.SelectedIndex = 0; buttonStartStop.Enabled = true; } }
private void comboBoxOutputDevice_SelectedValueChanged(object sender, EventArgs e) { m_selectedDevice = null; if (comboBoxOutputDevice.SelectedIndex < 0) { return; } m_selectedDevice = ((StringObjectPair <DeckLinkOutputDevice>)comboBoxOutputDevice.SelectedItem).value; // Update the video mode popup menu RefreshVideoModeList(); // Enable the interface EnableInterface(true); }
void AddDevice(IDeckLink decklinkDevice) { DeckLinkOutputDevice deckLink = new DeckLinkOutputDevice(decklinkDevice); if (deckLink.deckLinkOutput != null) { comboBoxOutputDevice.BeginUpdate(); comboBoxOutputDevice.Items.Add(new StringObjectPair <DeckLinkOutputDevice>(deckLink.deviceName, deckLink)); comboBoxOutputDevice.EndUpdate(); if (comboBoxOutputDevice.Items.Count == m_number) { comboBoxOutputDevice.SelectedIndex = m_number - 1; // StartRunning(); } } }