Example #1
0
    // Close current video source
    private void CloseVideoSource()
    {
      Camera camera = cameraWindow1.Camera;

      if (camera != null)
      {
        // stop timer
        timer.Stop();

        // detach camera from camera window
        cameraWindow1.Camera = null;
        Application.DoEvents();

        // signal camera to stop
        camera.SignalToStop();
        // wait 2 seconds until camera stops
        for (int i = 0; (i < 20) && (camera.IsRunning); i++)
        {
          Thread.Sleep(100);
        }
        if (camera.IsRunning)
          camera.Stop();
        camera = null;

        // reset motion detector
        if (detector != null)
          detector.Reset();
      }
    }
Example #2
0
        // Close current file
        private void CloseFile( )
        {
            Camera camera = cameraWindow.Camera;

            if (camera != null)
            {
                // detach camera from camera window
                cameraWindow.Camera = null;

                // signal camera to stop
                camera.SignalToStop( );
                // wait for the camera
                camera.WaitForStop( );

                camera = null;

                if (detector != null)
                {
                    detector.Reset( );
                }
            }

            if (writer != null)
            {
                writer.Dispose( );
                writer = null;
            }
            intervalsToSave = 0;
        }
Example #3
0
        public void Kamera_VideoError(object sender, VideoSourceErrorEventArgs e)
        {
            if (mdetector != null)
            {
                mdetector.Reset();
            }
            sonframeHata = e.Description;

            if (VideoError != null)
            {
                VideoError(this, new EventArgs());
            }
        }
Example #4
0
        // Close current file
        private void CloseFile()
        {
            Camera camera = cameraWindow.Camera;

            if (camera != null)
            {
                // detach camera from camera window
                cameraWindow.Camera = null;

                // signal camera to stop
                camera.SignalToStop();
                camera.Stop();
                //// wait for the camera
                //camera.WaitForStop();

                camera    = null;
                IsPlaying = false;

                if (detector != null)
                {
                    detector.Reset();
                }
            }

            if (writer != null)
            {
                writer.Dispose();
                writer = null;
            }
            intervalsToSave = 0;
            if (saveOnMotion)
            {
                toolStripStatusLabel1.Text = "Monitor..";
            }
            else
            {
                toolStripStatusLabel1.Text = "View..";
            }
            //cameraWindow.BackColor = SystemColors.ButtonFace;
            Graphics.FromHwnd(cameraWindow.Handle).Clear(SystemColors.ButtonFace);
            Rectangle rec = new Rectangle();

            rec.Size = new Size(cameraWindow.Size.Width - 2, cameraWindow.Size.Height - 2);
            rec.X    = 0; rec.Y = 0;
            Graphics.FromHwnd(cameraWindow.Handle).DrawRectangle(Pens.Black, rec);

            DidMailSent = false;
        }
Example #5
0
        /// <summary>
        /// Reset motion detector to initial state.
        /// </summary>
        ///
        /// <remarks><para>The method resets motion detection and motion processing algotithms by calling
        /// their <see cref="IMotionDetector.Reset"/> and <see cref="IMotionProcessing.Reset"/> methods.</para>
        /// </remarks>
        ///
        public void Reset( )
        {
            // lock ( _sync )
            {
                _detector?.Reset( );
                _processor?.Reset( );

                _videoWidth  = 0;
                _videoHeight = 0;

                if (_zonesFrame != null)
                {
                    _zonesFrame.Dispose( );
                    _zonesFrame = null;
                }
            }
        }
Example #6
0
        // On video source error
        private void video_VideoSourceError(object sender, VideoSourceErrorEventArgs e)
        {
            // reset motion detector
            if (motionDetecotor != null)
            {
                motionDetecotor.Reset( );
            }

            // save video source error's description
            lastVideoSourceError = e.Description;

            // notify clients about the error
            if (VideoSourceError != null)
            {
                VideoSourceError(this, new EventArgs( ));
            }
        }
Example #7
0
        // Close current file
        private void CloseFile()
        {
            Camera camera = cameraWindow.Camera;

            if (camera != null)
            {
                // detach camera from camera window
                cameraWindow.Camera = null;

                // signal camera to stop
                camera.SignalToStop();
                // wait for the camera
                camera.WaitForStop();

                camera = null;

                if (detector != null)
                {
                    detector.Reset();
                }
            }
        }
Example #8
0
        /// <summary>
        /// 开启摄像头前,先关闭资源
        /// </summary>
        void CloseFile()
        {
            Camera camera = MainWindow.CameraWindow.Camera;

            if (camera != null)
            {
                MainWindow.CameraWindow.Camera = null;
                camera.SignalToStop();
                camera.WaitForStop();
                camera = null;

                if (detector != null)
                {
                    detector.Reset();
                }
            }
            if (writer != null)
            {
                writer.Dispose();
                writer = null;
            }
        }
Example #9
0
        private void CloseFile()
        {
            Camera camera = _CameraWindow.Camera;

            if (camera != null)
            {
                _CameraWindow.Camera = null;    // detach camera from camera window
                camera.Stop();
                camera = null;

                if (_MotionDetector != null)
                {
                    _MotionDetector.Reset();
                }
            }

            if (writer != null)
            {
                writer.Dispose();
                writer = null;
            }
            intervalsToSave = 0;
        }
Example #10
0
        public void stopCamera()
        {
            if (camera != null)
            {
                camera.SignalToStop();
                //This is where we freze at on exit
                //  --gotta be a fix for this
                //camera.WaitForStop();
                camera = null;
            }

            // detach camera from camera window
            view.Camera = null;

            if (detector != null)
            {
                detector.Reset();
            }


            view.AlarmInterval = 0;
            view.Hide();
        }
Example #11
0
        private void CloseVideo()
        {
            try
            {
                Kamera camera = kameraKutusu1.Camera;
                if (camera != null)
                {
                    kameraKutusu1.Camera = null;
                    Application.DoEvents();

                    camera.Stop();
                    camera = null;

                    if (mdetector != null)
                    {
                        mdetector.Reset();
                    }

                    ivideo = null;
                }
            }
            catch { }
        }