MobileDocumentPhotoLibrarySource.cs 712 B

123456789101112131415161718192021
  1. using Microsoft.Maui.ApplicationModel;
  2. using Microsoft.Maui.Storage;
  3. using InABox.Avalonia.Platform;
  4. namespace InABox.Avalonia
  5. {
  6. public class MobileDocumentPhotoLibrarySource : MobileImageSource<MobileDocumentPhotoLibrarySource, MobileDocumentPhotoLibraryOptions>
  7. {
  8. public MobileDocumentPhotoLibrarySource(MobileDocumentPhotoLibraryOptions options) : base(options)
  9. {
  10. }
  11. protected override async Task<bool> IsEnabled()
  12. => await IsEnabled<Permissions.Photos>();
  13. protected override async Task<FileResult> Capture()
  14. => await PlatformTools.ImageTools.PickPhotoAsync(Options.Compression, Options.Constraints);
  15. }
  16. }