private void ConnectToDevice(FilterInfoCollection _devices, int _iSelected) { m_CurrentVideoDevice = new DeviceIdentifier(_devices[_iSelected].Name, _devices[_iSelected].MonikerString); log.Debug(String.Format("Connecting to device: index: {0}, name: {1}, moniker string:{2}", _iSelected, m_CurrentVideoDevice.Name, m_CurrentVideoDevice.Identification)); ConnectToDevice(m_CurrentVideoDevice); m_Container.Connected(); }
public override void PromptDeviceSelector() { // Ask the user which device he wants to use. formDevicePicker fdp = new formDevicePicker(ListDevices(), m_CurrentVideoDevice); if(fdp.ShowDialog() == DialogResult.OK) { DeviceIdentifier selected = fdp.SelectedDevice; if(selected != null) { m_CurrentVideoDevice = selected; ConnectToDevice(m_CurrentVideoDevice); m_Container.Connected(); } } fdp.Dispose(); }
private void ConnectToDevice(DeviceIdentifier _device) { Disconnect(); log.Debug(String.Format("Connecting to device. {0}", _device.Name)); m_VideoDevice = new VideoCaptureDevice(_device.Identification); m_VideoDevice.DesiredFrameRate = 0; m_VideoDevice.NewFrame += new NewFrameEventHandler( VideoDevice_NewFrame ); m_bIsConnected = true; if(m_VideoDevice.VideoCapabilities.Length > 0) { m_FrameSize = m_VideoDevice.VideoCapabilities[0].FrameSize; m_FramesInterval = 1000 / m_VideoDevice.VideoCapabilities[0].MaxFrameRate; log.Debug(String.Format("Reading Device Capabilities. Frame size:{0}, Frames interval : {1}", m_FrameSize, m_FramesInterval)); } }
public formDevicePicker(List <DeviceIdentifier> _devices, DeviceIdentifier _currentDevice) { InitializeComponent(); this.Text = " " + ScreenManagerLang.ToolTip_DevicePicker; this.btnApply.Text = ScreenManagerLang.Generic_Apply; this.btnCancel.Text = ScreenManagerLang.Generic_Cancel; lblCurrentlySelected.Text = ScreenManagerLang.dlgDevicePicker_CurrentlySelected + " " + _currentDevice.Name; lblSelectAnother.Text = ScreenManagerLang.dlgDevicePicker_SelectAnother; // Populate the list. foreach (DeviceIdentifier di in _devices) { if (di.Identification != _currentDevice.Identification) { lstOtherDevices.Items.Add(di); } } }