MobileDocumentPhotoLibrarySource.cs 663 B

1234567891011121314151617181920
  1. using System.Threading.Tasks;
  2. using Xamarin.Essentials;
  3. namespace InABox.Mobile
  4. {
  5. public class MobileDocumentPhotoLibrarySource : MobileImageSource<MobileDocumentPhotoLibrarySource, MobileDocumentPhotoLibraryOptions>
  6. {
  7. public MobileDocumentPhotoLibrarySource(MobileDocumentPhotoLibraryOptions options) : base(options)
  8. {
  9. }
  10. protected override async Task<bool> IsEnabled()
  11. => await IsEnabled<Permissions.Photos>();
  12. protected override async Task<FileResult> Capture()
  13. => await MobileUtils.ImageTools.PickPhotoAsync(Options.Compression, Options.Constraints);
  14. }
  15. }