private ImageGrabber _imageGrabber; // image grabber #endregion Fields #region Constructors public VideoDevice(string name) { if (_instance != null) _instance.freeDeviceResources(); _devname = name; _deviceId = Array.IndexOf(_devs, _vdevs[_devname]); _imageGrabber = new ImageGrabber(_deviceId); _instance = this; }
private void setSelectedDevice(object sender, SelectionChangedEventArgs e) { // select video device var combo = sender as ComboBox; if (combo == null) return; string devName = combo.SelectedItem as string; if ((string.IsNullOrWhiteSpace(devName)) || (devName.Equals("<no available devices>"))) return; videoDev = new VideoDevice(devName); CaptureTestButton.IsEnabled = true; CaptureStartButton.IsEnabled = true; ClearPreviewButton.IsEnabled = true; }