public async Task<IMediaFile> TakePhoto(CameraOptions options) { if (!this.IsCameraAvailable) throw new ArgumentException("Camera is not available"); options = options ?? new CameraOptions(); try { var file = await this.picker.TakePhotoAsync(new StoreCameraMediaOptions { Directory = options.GetDirectory(), Name = options.GetFileName(), DefaultCamera = (XamCamDevice)Enum.Parse(typeof(XamCamDevice), options.Camera.ToString()) }); return new MediaFile(file); } catch (OperationCanceledException) { return null; } }
public async Task <IMediaFile> TakePhoto(CameraOptions options) { if (!this.IsCameraAvailable) { throw new ArgumentException("Camera is not available"); } options = options ?? new CameraOptions(); try { var file = await this.picker.TakePhotoAsync(new StoreCameraMediaOptions { Directory = options.GetDirectory(), Name = options.GetFileName(), DefaultCamera = (XamCamDevice)Enum.Parse(typeof(XamCamDevice), options.Camera.ToString()) }); return(new MediaFile(file)); } catch (OperationCanceledException) { return(null); } }