// Constructor public CaptureDeviceForm() { // // Required for Windows Form Designer support // InitializeComponent(); // try { filters = new FilterCollection(FilterCategory.VideoInputDevice); if (filters.Count == 0) throw new ApplicationException(); // add all devices to combo foreach (Filter filter in filters) { deviceCombo.Items.Add(filter.Name); } } catch (ApplicationException) { deviceCombo.Items.Add("No local capture devices"); deviceCombo.Enabled = false; okButton.Enabled = false; } deviceCombo.SelectedIndex = 0; }
private void captureDevicesLst_Loaded(object sender, RoutedEventArgs e) { captureDevices = new FilterCollection(FilterCategory.VideoInputDevice); foreach (Filter filt in captureDevices) { captureDevicesLst.Items.Add(filt.Name); } }
public CaptureDeviceSetupPage() { InitializeComponent(); filters = new FilterCollection(FilterCategory.VideoInputDevice); if (filters.Count == 0) { cbDevice.Items.Add("本地无摄像头设备"); cbDevice.Enabled = false; } else { // add all devices to combo foreach (Filter filter in filters) { cbDevice.Items.Add(filter.Name); } completed = true; } cbDevice.SelectedIndex = 0; }
// Constructor public CaptureDeviceSetupPage() { // This call is required by the Windows.Forms Form Designer. InitializeComponent(); // filters = new FilterCollection(FilterCategory.VideoInputDevice); if (filters.Count == 0) { deviceCombo.Items.Add("No local capture devices"); deviceCombo.Enabled = false; } else { // add all devices to combo foreach (Filter filter in filters) { deviceCombo.Items.Add(filter.Name); } completed = true; } deviceCombo.SelectedIndex = 0; }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); _Font1 = Content.Load<SpriteFont>("SpriteFont1"); FilterCollection filters = new FilterCollection(FilterCategory.VideoInputDevice); if( filters.Count != 0) { _cam = new CaptureDevice(GraphicsDevice); _cam.VideoSource = filters[0].MonikerString; _cam.Start(); _cam.NewFrame += new CameraEventHandler(_cam_NewFrame); } _objectTex = _surf.InitToTexture(GraphicsDevice, "box2.png"); // TODO: use this.Content to load your game content here }
public void setDevices() { filters = new FilterCollection(FilterCategory.VideoInputDevice); if (filters.Count == 0) { MessageBox.Show("No camera's found", "Not Found", MessageBoxButton.OK, MessageBoxImage.Warning); return; } devices = new String[filters.Count]; int count = 0; foreach (Filter filter in filters) { devices[count++] = filter.Name; } }