/// <summary> /// Determines whether the specified <see cref="CaptureParameters"/> is equal to this instance. /// </summary> /// <param name="other">The <see cref="CaptureParameters"/> to compare with this instance.</param> /// <returns> /// <see langword="true"/>, if the specified <see cref="CaptureParameters"/> is equal to this instance; otherwise, <see langword="false"/>. /// </returns> public bool Equals(CaptureParameters other) { if (other == null) { return false; } if (this.FlashMode != other.FlashMode) { return false; } if (this.ImageEncoding == null) { return other.ImageEncoding == null; } if (!object.ReferenceEquals(this.ImageEncoding, other.ImageEncoding)) { return true; } if (this.ImageEncoding.Height != other.ImageEncoding.Height || this.ImageEncoding.Width != other.ImageEncoding.Width || !string.Equals(this.ImageEncoding.Type, other.ImageEncoding.Type, StringComparison.OrdinalIgnoreCase) || !string.Equals(this.ImageEncoding.Subtype, other.ImageEncoding.Subtype, StringComparison.OrdinalIgnoreCase)) { return false; } return true; }
/// <summary> /// Determines whether the specified <see cref="CaptureParameters"/> is equal to this instance. /// </summary> /// <param name="other">The <see cref="CaptureParameters"/> to compare with this instance.</param> /// <returns> /// <see langword="true"/>, if the specified <see cref="CaptureParameters"/> is equal to this instance; otherwise, <see langword="false"/>. /// </returns> public bool Equals(CaptureParameters other) { if (other == null) { return(false); } if (this.FlashMode != other.FlashMode) { return(false); } if (this.ImageEncoding == null) { return(other.ImageEncoding == null); } if (!object.ReferenceEquals(this.ImageEncoding, other.ImageEncoding)) { return(true); } if (this.ImageEncoding.Height != other.ImageEncoding.Height || this.ImageEncoding.Width != other.ImageEncoding.Width || !string.Equals(this.ImageEncoding.Type, other.ImageEncoding.Type, StringComparison.OrdinalIgnoreCase) || !string.Equals(this.ImageEncoding.Subtype, other.ImageEncoding.Subtype, StringComparison.OrdinalIgnoreCase)) { return(false); } return(true); }
/// <summary> /// Updates the current camera settings. /// </summary> private void UpdateCameraSettings(CaptureParameters parameters) { this.SetFlashMode(parameters.FlashMode); // Thumbnail will be created by the storage service. // Enable it, if you want a faster thumbnail generation, which will be sent with the CapturedPhoto. this.CameraController.MediaCapture.VideoDeviceController.LowLagPhoto.ThumbnailEnabled = false; // Also disable photo confirmation thumbnails. if (this.CameraController.MediaCapture.VideoDeviceController.PhotoConfirmationControl.Supported) { this.CameraController.MediaCapture.VideoDeviceController.PhotoConfirmationControl.Enabled = false; } }
/// <summary> /// Initializes a new instance of the <see cref="InitializePhotoCaptureTask"/> class. /// </summary> /// <param name="cameraController">Current camera controller.</param> /// <param name="photoCapture">Photo capture to initialize.</param> /// <param name="captureParameters">Photo capture parameters.</param> /// <exception cref="ArgumentNullException"> /// <paramref name="cameraController"/> is <see langword="null"/>. /// <para>-or-</para> /// <paramref name="photoCapture"/> is <see langword="null"/>. /// <para>-or-</para> /// <paramref name="captureParameters"/> is <see langword="null"/>. /// </exception> public InitializePhotoCaptureTask(CameraController cameraController, IPhotoCapture photoCapture, CaptureParameters captureParameters) : base(cameraController) { if (photoCapture == null) { throw new ArgumentNullException("photoCapture"); } if (captureParameters == null) { throw new ArgumentNullException("captureParameters"); } this.photoCapture = photoCapture; this.captureParameters = captureParameters; }
/// <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> /// 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 capture is already initialized.</exception> public override async Task InitializeAsync(CaptureParameters parameters) { if (parameters == null || parameters.ImageEncoding == null) { throw new ArgumentNullException("parameters"); } if (this.photoCapture != null) { throw new InvalidOperationException("Low lag photo capture is already initialized."); } this.captureParameters = parameters; this.UpdateCameraSettings(this.captureParameters); this.photoCapture = await this.CameraController.MediaCapture.PrepareLowLagPhotoCaptureAsync(parameters.ImageEncoding); }
/// <summary> /// Updates the current <c>VPS</c> frame controllers. /// </summary> private void UpdateCameraSettings(CaptureParameters parameters) { this.SetFlashMode(parameters.FlashMode); // Disable photo confirmation thumbnails for VPS. if (this.CameraController.MediaCapture.VideoDeviceController.PhotoConfirmationControl.Supported) { this.CameraController.MediaCapture.VideoDeviceController.PhotoConfirmationControl.Enabled = false; } VariablePhotoSequenceController controller = this.CameraController.MediaCapture.VideoDeviceController.VariablePhotoSequenceController; controller.DesiredFrameControllers.Clear(); for (int frameIndex = 0; frameIndex < VariablePhotoCapture.NumFrames; frameIndex++) { FrameController frame = new FrameController(); controller.DesiredFrameControllers.Add(frame); } }
/// <summary> /// Initializes a new photo capture controller, if needed. /// </summary> /// <param name="captureMode">Photo capture mode.</param> /// <param name="parameters">Camera capture parameters.</param> /// <returns>Awaitable task.</returns> /// <exception cref="ArgumentNullException"><paramref name="parameters"/> is <see langword="null"/>.</exception> /// <exception cref="NotImplementedException"><paramref name="captureMode"/> is not supported.</exception> public async Task InitializePhotoCaptureAsync(CaptureMode captureMode, CaptureParameters parameters) { if (parameters == null) { throw new ArgumentNullException("parameters"); } if (parameters.ImageEncoding == null) { throw new ArgumentNullException("parameters", "Image encoding is not set."); } Tracing.Trace("PhotoCamera::InitializePhotoCaptureAsync"); if (this.photoCapture != null && this.CaptureMode == captureMode && parameters.Equals(this.CaptureParameters)) { Tracing.Trace("PhotoCamera: Capture is already initialized with the same parameters."); return; } this.CaptureMode = captureMode; this.CaptureParameters = parameters; await this.DestroyPhotoCaptureAsync(); this.photoCapture = this.CreatePhotoCapture(captureMode); await this.TaskEngine.EnqueueTaskAsync(new InitializePhotoCaptureTask(this.CameraController, this.photoCapture, parameters)); }
/// <summary> /// Initializes the photo capture on the current camera device. /// </summary> /// <param name="parameters">Capture parameters.</param> /// <returns>Awaitable task.</returns> public abstract Task InitializeAsync(CaptureParameters parameters);