Esempio n. 1
0
        private void ResolutionCB_SelectedIndexChanged(object sender, EventArgs e)
        {
            videoSource.VideoResolution = videoSource.VideoCapabilities[ResolutionCB.SelectedIndex];
            if (videoSource.IsRunning)
            {
                videoSource.SignalToStop();
                videoSource.WaitForStop();

                SnapshotButton.Enabled = videoSource.IsRunning;
                RecordButton.Enabled   = videoSource.IsRunning;

                CaptureBox.Invoke(
                    new Action(
                        delegate
                {
                    CaptureBox.Image = null;
                    CaptureBox.Invalidate();
                }));
                videoSource.NewFrame += videoSource_NewFrame;
                videoSource.Start();

                SnapshotButton.Enabled = videoSource.IsRunning;
                RecordButton.Enabled   = videoSource.IsRunning;
            }

            CaptureButton.Enabled = true;
        }
Esempio n. 2
0
 private void CaptureButton_Click(object sender, EventArgs e)
 {
     if (videoSource != null)
     {
         if (videoSource.IsRunning)
         {
             videoSource.SignalToStop();
             videoSource.WaitForStop();
             CaptureBox.Invoke(
                 new Action(
                     delegate
             {
                 CaptureBox.Image = null;
                 CaptureBox.Invalidate();
             }));
             CaptureButton.Name = "Start";
         }
         else
         {
             videoSource.NewFrame += videoSource_NewFrame;
             videoSource.Start();
             CaptureButton.Name = "Stop";
         }
         SnapshotButton.Enabled = videoSource.IsRunning;
         RecordButton.Enabled   = videoSource.IsRunning;
     }
 }
Esempio n. 3
0
        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            recordVideo    = false;
            browserRunning = false;
            if (videoSource.IsRunning)
            {
                videoSource.SignalToStop();

                CaptureBox.Invoke(
                    new Action(
                        delegate
                {
                    CaptureBox.Image = null;
                    CaptureBox.Invalidate();
                }));

                videoSource = null;
            }
        }