Exemplo n.º 1
0
        /// <summary>
        /// The <see cref="VariablePhotoSequenceCapture.Stopped"/> event handler.
        /// </summary>
        /// <param name="sender">Event sender.</param>
        /// <param name="e">Event data.</param>
        private void PhotoSequenceOnStopped(VariablePhotoSequenceCapture sender, object e)
        {
            this.photoSequence.PhotoCaptured -= this.PhotoSequenceOnPhotoCaptured;
            this.photoSequence.Stopped       -= this.PhotoSequenceOnStopped;

            this.started = false;

            this.NotifyStopped();
        }
Exemplo n.º 2
0
        /// <summary>
        /// The <see cref="VariablePhotoSequenceCapture.PhotoCaptured"/> event handler.
        /// </summary>
        /// <param name="sender">Event sender.</param>
        /// <param name="e">The <see cref="VariablePhotoCapturedEventArgs"/> instance containing the event data.</param>
        private void PhotoSequenceOnPhotoCaptured(VariablePhotoSequenceCapture sender, VariablePhotoCapturedEventArgs e)
        {
            Tracing.Trace("VariablePhotoCapture: Photo captured. Time offset: {0}, frame index: {1}", e.CaptureTimeOffset, e.UsedFrameControllerIndex);

            EventHandler <CapturedFrame> handler = this.PhotoCaptured;

            if (handler != null)
            {
                handler.Invoke(this, e.Frame);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Initializes the photo capture on the current camera device.
        /// </summary>
        /// <param name="parameters">Capture parameters.</param>
        /// <returns>Awaitable task.</returns>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="parameters"/> is <see langword="null"/>.
        ///     <para>-or-</para>
        /// Image encoding is not set in the <paramref name="parameters"/>.
        /// </exception>
        /// <exception cref="InvalidOperationException">Photo sequence is already initialized.</exception>
        public override async Task InitializeAsync(CaptureParameters parameters)
        {
            if (parameters == null || parameters.ImageEncoding == null)
            {
                throw new ArgumentNullException("parameters");
            }

            if (this.photoSequence != null)
            {
                throw new InvalidOperationException("Variable photo capture is already initialized.");
            }

            this.UpdateCameraSettings(parameters);

            this.photoSequence = await this.CameraController.MediaCapture.PrepareVariablePhotoSequenceCaptureAsync(parameters.ImageEncoding);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Unloads the internal sequence objects.
        /// </summary>
        /// <returns>Awaitable task.</returns>
        public override async Task UnloadAsync()
        {
            if (this.photoSequence == null)
            {
                return;
            }

            await this.StopAsync();

            try
            {
                await this.photoSequence.FinishAsync();
            }
            catch (Exception e)
            {
                Tracing.Trace("VariablePhotoCapture: Exception while finishing capture:\r\n{0}", e);
            }

            this.photoSequence = null;
        }
        /// <summary>
        /// Initializes the photo capture on the current camera device.
        /// </summary>
        /// <param name="parameters">Capture parameters.</param>
        /// <returns>Awaitable task.</returns>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="parameters"/> is <see langword="null"/>.
        ///     <para>-or-</para>
        /// Image encoding is not set in the <paramref name="parameters"/>.
        /// </exception>
        /// <exception cref="InvalidOperationException">Photo sequence is already initialized.</exception>
        public override async Task InitializeAsync(CaptureParameters parameters)
        {
            if (parameters == null || parameters.ImageEncoding == null)
            {
                throw new ArgumentNullException("parameters");
            }

            if (this.photoSequence != null)
            {
                throw new InvalidOperationException("Variable photo capture is already initialized.");
            }

            this.UpdateCameraSettings(parameters);

            this.photoSequence = await this.CameraController.MediaCapture.PrepareVariablePhotoSequenceCaptureAsync(parameters.ImageEncoding);
        }
        /// <summary>
        /// The <see cref="VariablePhotoSequenceCapture.Stopped"/> event handler.
        /// </summary>
        /// <param name="sender">Event sender.</param>
        /// <param name="e">Event data.</param>
        private void PhotoSequenceOnStopped(VariablePhotoSequenceCapture sender, object e)
        {
            this.photoSequence.PhotoCaptured -= this.PhotoSequenceOnPhotoCaptured;
            this.photoSequence.Stopped       -= this.PhotoSequenceOnStopped;

            this.started = false;

            this.NotifyStopped();
        }
        /// <summary>
        /// The <see cref="VariablePhotoSequenceCapture.PhotoCaptured"/> event handler.
        /// </summary>
        /// <param name="sender">Event sender.</param>
        /// <param name="e">The <see cref="VariablePhotoCapturedEventArgs"/> instance containing the event data.</param>
        private void PhotoSequenceOnPhotoCaptured(VariablePhotoSequenceCapture sender, VariablePhotoCapturedEventArgs e)
        {
            Tracing.Trace("VariablePhotoCapture: Photo captured. Time offset: {0}, frame index: {1}", e.CaptureTimeOffset, e.UsedFrameControllerIndex);

            EventHandler<CapturedFrame> handler = this.PhotoCaptured;
            if (handler != null)
            {
                handler.Invoke(this, e.Frame);
            }
        }
        /// <summary>
        /// Unloads the internal sequence objects.
        /// </summary>
        /// <returns>Awaitable task.</returns>
        public override async Task UnloadAsync()
        {
            if (this.photoSequence == null)
            {
                return;
            }

            await this.StopAsync();

            try
            {
                await this.photoSequence.FinishAsync();
            }
            catch (Exception e)
            {
                Tracing.Trace("VariablePhotoCapture: Exception while finishing capture:\r\n{0}", e);
            }

            this.photoSequence = null;
        }
 public VariablePhotoSequenceCaptureEvents(VariablePhotoSequenceCapture This)
 {
     this.This = This;
 }