Пример #1
0
        private void CloseFile()
        {
            motion.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;
        }
Пример #2
0
        // Open video source
        private void OpenVideoSource( IVideoSource source )
        {
            // set busy cursor
            this.Cursor = Cursors.WaitCursor;

            // close previous file
            CloseFile( );

            // enable/disable motion alarm
            if ( detector != null )
            {
                detector.MotionLevelCalculation = motionAlarmItem.Checked;
            }

            // create camera
            Camera camera = new Camera( source, detector );
            // start camera
            camera.Start( );

            // attach camera to camera window
            cameraWindow.Camera = camera;

            // reset statistics
            statIndex = statReady = 0;

            // set event handlers
            camera.NewFrame += new EventHandler( camera_NewFrame );
            camera.Alarm += new EventHandler( camera_Alarm );

            // start timer
            timer.Start( );

            this.Cursor = Cursors.Default;
        }
Пример #3
0
        // Open video source
        public void OpenVideoSource(IVideoSource source)
        {
            // set busy cursor
            Cursor = Cursors.WaitCursor;

            // close previous file
            CloseFile();

            // create camera
            var camera = new Camera(source, detector);
            // start camera
            camera.Start();
            // attach camera to camera window
            cameraWindow.Camera = camera;
            if (!Lines)
            {
                Graphics dc = cameraWindow.CreateGraphics();
                var redPen = new Pen(Color.Red, 1);
                dc.DrawLine(redPen, pictureBox1.Size.Width / 2, 0, pictureBox1.Size.Width / 2, pictureBox1.Size.Height);
                dc.DrawLine(redPen, 0, pictureBox1.Size.Height / 2, pictureBox1.Size.Width, pictureBox1.Size.Height / 2);
            }

            // reset statistics
            //  statIndex = statReady = 0;

            // start timer
            timer.Start();

            this.Cursor = Cursors.Default;
        }
Пример #4
0
        // Open video source
        private void OpenVideoSource(IVideoSource source)
        {
            // set busy cursor
            this.Cursor = Cursors.WaitCursor;

            // close previous file
            CloseFile();

            // create camera
            Camera camera = new Camera(source, detector);
            // start camera
            camera.Start();

            // attach camera to camera window
            cameraWindow.Camera = camera;

            // reset statistics
            statIndex = statReady = 0;

            // start timer
            timer.Start();

            this.Cursor = Cursors.Default;
        }