MobileDocumentPhotoLibrarySource.cs 759 B

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