MobileDocumentCameraSource.cs 682 B

1234567891011121314151617181920
  1. using Avalonia.Controls;
  2. using InABox.Avalonia.Platform;
  3. namespace InABox.Avalonia
  4. {
  5. public class MobileDocumentCameraSource : MobileImageSource<MobileDocumentCameraSource, MobileDocumentCameraOptions>
  6. {
  7. public MobileDocumentCameraSource(MobileDocumentCameraOptions options) : base(options)
  8. {
  9. }
  10. protected override async Task<bool> IsEnabled()
  11. => await PlatformTools.Permissions.IsPermitted(Permission.Camera);
  12. protected override async Task<ImageFile?> Capture(TopLevel window)
  13. => await PlatformTools.ImageTools.CapturePhotoAsync(window, Options.Compression, Options.Constraints);
  14. }
  15. }