/// <summary> detect first form appearance, start grabber. </summary> private void MainForm_Activated(object sender, System.EventArgs e) { if (firstActive) { return; } firstActive = true; if (!DsUtils.IsCorrectDirectXVersion()) { MessageBox.Show(this, "DirectX 8.1 NOT installed!", "DirectShow.NET", MessageBoxButtons.OK, MessageBoxIcon.Stop); this.Close(); return; } if (!DsDev.GetDevicesOfCat(FilterCategory.VideoInputDevice, out capDevices)) { MessageBox.Show(this, "No video capture devices found!", "DirectShow.NET", MessageBoxButtons.OK, MessageBoxIcon.Stop); this.Close(); return; } DsDevice dev = null; if (capDevices.Count == 1) { dev = capDevices[0] as DsDevice; } else { DeviceSelector selector = new DeviceSelector(capDevices); selector.ShowDialog(this); dev = selector.SelectedDevice; } if (dev == null) { this.Close(); return; } if (!StartupVideo(dev.Mon)) { this.Close(); } }
/// <summary> detect first form appearance, start grabber. </summary> private void MainForm_Activated(object sender, System.EventArgs e) { if( firstActive ) return; firstActive = true; if( ! DsUtils.IsCorrectDirectXVersion() ) { MessageBox.Show( this, "DirectX 8.1 NOT installed!", "DirectShow.NET", MessageBoxButtons.OK, MessageBoxIcon.Stop ); this.Close(); return; } if( ! DsDev.GetDevicesOfCat( FilterCategory.VideoInputDevice, out capDevices ) ) { MessageBox.Show( this, "No video capture devices found!", "DirectShow.NET", MessageBoxButtons.OK, MessageBoxIcon.Stop ); this.Close(); return; } DsDevice dev = null; if( capDevices.Count == 1 ) dev = capDevices[0] as DsDevice; else { DeviceSelector selector = new DeviceSelector( capDevices ); selector.ShowDialog( this ); dev = selector.SelectedDevice; } if( dev == null ) { this.Close(); return; } if( ! StartupVideo( dev.Mon ) ) this.Close(); }