Пример #1
0
        /// <summary>
        /// ////////////////////////////////////////////////////////////////////////////////////////////////////////
        /// ////////////////////////////////////////////////////////////////////////////////////////////////////////
        private void frmCapture_Activated() //private void frmCapture_Activated(object sender, 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;
            }

            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;

            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();
            }
            this.Text = "机器狗调试软件-哈尔滨工程大学";
        }
Пример #2
0
        //private void frmCapture_Activated(object sender, EventArgs e)
        /// <summary>
        /// ////////////////////////////////////////////////////////////////////////////////////////////////////////
        /// ////////////////////////////////////////////////////////////////////////////////////////////////////////
        private void frmCapture_Activated()
        {
            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;
            }

            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;

            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();
            this.Text = "机器狗调试软件-哈尔滨工程大学";
        }