Esempio n. 1
0
        /// <summary>
        /// Takes the picture.
        /// </summary>
        /// <param name="options">The storage options.</param>
        /// <returns>Task with a return type of MediaFile.</returns>
        /// <exception cref="System.NotSupportedException">Throws an exception if feature is not supported.</exception>
        public Task <MediaFile> TakePhotoAsync(CameraMediaStorageOptions options)
        {
            if (!IsCameraAvailable)
            {
                throw new NotSupportedException();
            }

            options.VerifyOptions();

            return(TakeMediaAsync("image/*", MediaStore.ActionImageCapture, options));
        }
Esempio n. 2
0
        /// <summary>
        /// Select a picture from library.
        /// </summary>
        /// <param name="options">The storage options.</param>
        /// <returns>Task with a return type of MediaFile.</returns>
        /// <exception cref="System.NotSupportedException">Throws an exception if feature is not supported.</exception>
        public Task <MediaFile> SelectPhotoAsync(CameraMediaStorageOptions options)
        {
            if (!IsCameraAvailable)
            {
                throw new NotSupportedException();
            }

            options.VerifyOptions();

            return(TakeMediaAsync("image/*", Intent.ActionPick, options));
        }
Esempio n. 3
0
        /// <summary>
        /// Select a picture from library.
        /// </summary>
        /// <param name="options">The storage options.</param>
        /// <returns>Task with a return type of MediaFile.</returns>
        /// <exception cref="System.NotSupportedException">Throws an exception if feature is not supported.</exception>
        public Task<MediaFile> SelectPhotoAsync(CameraMediaStorageOptions options)
        {
            if (!IsCameraAvailable)
            {
                throw new NotSupportedException();
            }

            options.VerifyOptions();

            return TakeMediaAsync("image/*", Intent.ActionPick, options);
        }
Esempio n. 4
0
        /// <summary>
        /// Takes the picture.
        /// </summary>
        /// <param name="options">The storage options.</param>
        /// <returns>Task&lt;IMediaFile&gt;.</returns>
        /// <exception cref="InvalidOperationException">Only one operation can be active at a time</exception>
        /// <exception cref="System.NotImplementedException"></exception>
        public Task <MediaFile> TakePhotoAsync(CameraMediaStorageOptions options)
        {
            options.VerifyOptions();

            var ntcs = new TaskCompletionSource <MediaFile>(options);

            if (Interlocked.CompareExchange(ref _completionSource, ntcs, null) != null)
            {
                throw new InvalidOperationException("Only one operation can be active at a time");
            }

            _cameraCapture.Show();

            return(ntcs.Task);
        }
Esempio n. 5
0
        /// <summary>
        /// Takes the picture.
        /// </summary>
        /// <param name="options">The storage options.</param>
        /// <returns>Task with a return type of MediaFile.</returns>
        /// <exception cref="System.NotSupportedException">Throws an exception if feature is not supported.</exception>
        public Task<MediaFile> TakePhotoAsync(CameraMediaStorageOptions options)
        {
            if (!IsCameraAvailable)
            {
                throw new NotSupportedException();
            }   

            options.VerifyOptions();

            return TakeMediaAsync("image/*", MediaStore.ActionImageCapture, options);
        }
		/// <summary>
		/// Takes the picture.
		/// </summary>
		/// <param name="options">The storage options.</param>
		/// <returns>Task&lt;IMediaFile&gt;.</returns>
		/// <exception cref="InvalidOperationException">Only one operation can be active at a time</exception>
		/// <exception cref="System.NotImplementedException"></exception>
		public Task<MediaFile> TakePhotoAsync(CameraMediaStorageOptions options)
		{
			options.VerifyOptions();

			var ntcs = new TaskCompletionSource<MediaFile>(options);
			if (Interlocked.CompareExchange(ref _completionSource, ntcs, null) != null)
			{
				throw new InvalidOperationException("Only one operation can be active at a time");
			}

			_cameraCapture.Show();

			return ntcs.Task;
		}