MobileDocumentCameraSource.cs 678 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 MobileDocumentCameraSource : MobileImageSource<MobileDocumentCameraSource, MobileDocumentCameraOptions>
  7. {
  8. public MobileDocumentCameraSource(MobileDocumentCameraOptions options) : base(options)
  9. {
  10. }
  11. protected override async Task<bool> IsEnabled()
  12. => await IsEnabled<Permissions.Camera>();
  13. protected override async Task<FileResult> Capture()
  14. => await PlatformTools.ImageTools.CapturePhotoAsync(Options.Compression, Options.Constraints);
  15. }
  16. }