예제 #1
0
        private void frmCapture_Activated() //private void frmCapture_Activated(object sender, EventArgs e)
        {
            if (firstActive)
            {
                return;
            }
            firstActive = true;

            if (!prp.DsUtils.IsCorrectDirectXVersion())
            {
                MessageBox.Show(this, "DirectX 8.1 NOT installed!", "DirectShow.NET", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                this.Close(); return;
            }

            if (!prp.DsDev.GetDevicesOfCat(prp.FilterCategory.VideoInputDevice, out capDevices))
            {
                MessageBox.Show(this, "No video capture devices found!", "DirectShow.NET", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                this.Close(); return;
            }

            SaveFileDialog sd = new SaveFileDialog();

            sd.FileName    = @"CaptureNET.avi";
            sd.Title       = "Save Video Stream as...";
            sd.Filter      = "Video file (*.avi)|*.avi";
            sd.FilterIndex = 1;
            if (sd.ShowDialog() != DialogResult.OK)
            {
                this.Close(); return;
            }
            fileName = sd.FileName;

            prp.DsDevice dev = null;
            if (capDevices.Count == 1)
            {
                dev = capDevices[0] as prp.DsDevice;
            }
            else
            {
                prp.DeviceSelector selector = new prp.DeviceSelector(capDevices);
                selector.ShowDialog(this);
                dev = selector.SelectedDevice;
            }

            if (dev == null)
            {
                this.Close(); return;
            }

            if (!StartupVideo(dev.Mon))
            {
                this.Close();
            }
            this.Text = "虚拟现实机器人-北京交通大学";
        }
예제 #2
0
        //private void frmCapture_Activated(object sender, EventArgs e)
        private void frmCapture_Activated()
        {
            if (firstActive) return;
            firstActive = true;

            if (!prp.DsUtils.IsCorrectDirectXVersion())
            {
                MessageBox.Show(this, "DirectX 8.1 NOT installed!", "DirectShow.NET", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                this.Close(); return;
            }

            if (!prp.DsDev.GetDevicesOfCat(prp.FilterCategory.VideoInputDevice, out capDevices))
            {
                MessageBox.Show(this, "No video capture devices found!", "DirectShow.NET", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                this.Close(); return;
            }

            SaveFileDialog sd = new SaveFileDialog();
            sd.FileName = @"CaptureNET.avi";
            sd.Title = "Save Video Stream as...";
            sd.Filter = "Video file (*.avi)|*.avi";
            sd.FilterIndex = 1;
            if (sd.ShowDialog() != DialogResult.OK)
            { this.Close(); return; }
            fileName = sd.FileName;

            prp.DsDevice dev = null;
            if (capDevices.Count == 1)
                dev = capDevices[0] as prp.DsDevice;
            else
            {
                prp.DeviceSelector selector = new prp.DeviceSelector(capDevices);
                selector.ShowDialog(this);
                dev = selector.SelectedDevice;
            }

            if (dev == null)
            {
                this.Close(); return;
            }

            if (!StartupVideo(dev.Mon))
                this.Close();
            this.Text = "������ʵ������-������ͨ��ѧ";
        }