void StopCapture()
        {
            if (captureManager != null)
            {
                LogMessage("stopping capture...");
                try {
                    captureManager.StopCapture();

                    // unsubscribe events
                    captureManager.MovieSegmentCaptured -= HandleMovieSegmentCaptured;
                    captureManager.CaptureError         -= HandleCaptureError;
                    captureManager.ImageCaptured        -= HandleImageCaptured;
                    captureManager = null;
                } catch (Exception ex) {
                    Console.WriteLine(ex.Message);
                }
                LogMessage("capture stopped");
            }
            isCapturing = false;
        }
        private void stopCapture()
        {
            if (captureManager != null)
            {
                logMessage("stopping capture...");
                try
                {
                    captureManager.StopCapture();

                    // unsubscribe events
                    captureManager.MovieSegmentCaptured -= new EventHandler <MovieSegmentCapturedEventArgs>(handleMovieSegmentCaptured);
                    captureManager.CaptureError         -= new EventHandler <CaptureErrorEventArgs>(handleCaptureError);
                    captureManager.ImageCaptured        -= new EventHandler <ImageCaptureEventArgs>(handleImageCaptured);
                    captureManager = null;
                }
                catch
                {
                }
                logMessage("capture stopped");
            }
            isCapturing = false;
        }
		void StopCapture ()
		{
			if (captureManager != null) {
				LogMessage ("stopping capture...");
				try {
					captureManager.StopCapture ();

					// unsubscribe events
					captureManager.MovieSegmentCaptured -= HandleMovieSegmentCaptured;
					captureManager.CaptureError -= HandleCaptureError;
					captureManager.ImageCaptured -= HandleImageCaptured;
					captureManager = null;
				} catch (Exception ex) {
					Console.WriteLine (ex.Message);
				}
				LogMessage("capture stopped");
			}
			isCapturing = false;
		}
		void Capture ()
		{
			// stop capture if it is in progress
			StopCapture ();

			// make sure there is something configured for capture before starting up
			if (!settings.AudioCaptureEnabled && !settings.VideoCaptureEnabled && !settings.ImageCaptureEnabled) {
				LogMessage ("No capture devices enabled.  Enable one or more capture types in settings then retry");
				isCapturing = false;
				return;
			}

			// reset variables
			captureStartTime = DateTime.Now;
			nextImageIndex = 1;

			// create new capture manager and subscribe events
			LogMessage ("Creating and initializing capture graph");
			captureManager = new CaptureManager (
				settings.CaptureResolution,
				settings.ImageCaptureEnabled,
				settings.AudioCaptureEnabled,
				settings.VideoCaptureEnabled,
				settings.Camera,
				Settings.VideoDataPath,
				settings.MaxMovieDurationInSeconds * 1000,
				settings.AutoRecordNextMovie
			);

			// subscribe events
			captureManager.MovieSegmentCaptured += HandleMovieSegmentCaptured;
			captureManager.CaptureError += HandleCaptureError;
			captureManager.ImageCaptured += HandleImageCaptured;

			string errorMessage = null;
			LogMessage ("starting capture ...");
			if (captureManager.StartCapture (out errorMessage) == false) {
				LogMessage (errorMessage);
				return;
			}

			if (settings.VideoCaptureEnabled || settings.ImageCaptureEnabled)
				LogMessage (string.Format ("capture started at {0} resolution", settings.CaptureResolution));

			if (settings.AudioCaptureEnabled)
				LogMessage ("Capturing audio");

			if (settings.VideoCaptureEnabled)
				LogMessage ("Capturing video");

			if (settings.ImageCaptureEnabled)
				LogMessage ("Capturing image samples");

			isCapturing = true;
		}
        private void capture()
        {
            // stop capture if it is in progress
            stopCapture();

            // make sure there is something configured for capture before starting up
            if (!settings.AudioCaptureEnabled && !settings.VideoCaptureEnabled && !settings.ImageCaptureEnabled)
            {
                logMessage("No capture devices enabled.  Enable one or more capture types in settings then retry");
                isCapturing = false;
                return;
            }

            // reset variables
            captureStartTime = DateTime.Now;
            nextImageIndex   = 1;

            // create new capture manager and subscribe events
            logMessage("Creating and initializing capture graph");
            captureManager = new CaptureManager(
                settings.CaptureResolution,
                settings.ImageCaptureEnabled,
                settings.AudioCaptureEnabled,
                settings.VideoCaptureEnabled,
                settings.Camera,
                Settings.VideoDataPath,
                settings.MaxMovieDurationInSeconds * 1000,
                settings.AutoRecordNextMovie);

            // subscribe events
            captureManager.MovieSegmentCaptured += new EventHandler <MovieSegmentCapturedEventArgs>(handleMovieSegmentCaptured);
            captureManager.CaptureError         += new EventHandler <CaptureErrorEventArgs>(handleCaptureError);
            captureManager.ImageCaptured        += new EventHandler <ImageCaptureEventArgs>(handleImageCaptured);

            string errorMessage = null;

            logMessage("starting capture ...");
            if (captureManager.StartCapture(out errorMessage) == false)
            {
                logMessage(errorMessage);
                return;
            }
            if (settings.VideoCaptureEnabled || settings.ImageCaptureEnabled)
            {
                logMessage(string.Format("capture started at {0} resolution", settings.CaptureResolution));
            }
            if (settings.AudioCaptureEnabled)
            {
                logMessage(string.Format("Capturing audio"));
            }
            if (settings.VideoCaptureEnabled)
            {
                logMessage(string.Format("Capturing video"));
            }
            if (settings.ImageCaptureEnabled)
            {
                logMessage(string.Format("Capturing image samples"));
            }

            isCapturing = true;
        }
		private void stopCapture()
		{
			if ( captureManager != null )
			{
				logMessage("stopping capture...");
				try
				{
					captureManager.StopCapture();
					
					// unsubscribe events
					captureManager.MovieSegmentCaptured -= new EventHandler<MovieSegmentCapturedEventArgs>( handleMovieSegmentCaptured );
					captureManager.CaptureError -= new EventHandler<CaptureErrorEventArgs>( handleCaptureError );
					captureManager.ImageCaptured -= new EventHandler<ImageCaptureEventArgs>( handleImageCaptured );
					captureManager = null;
				}
				catch
				{
				}
				logMessage("capture stopped");
			}
			isCapturing = false;
		}