如何在 Xamarin Forms 上拍照使用库 Plugin.Media 时不打开页面 select "Retry" 或 "OK"?

How to don't open page select "Retry" or "OK" when take photo use library Plugin.Media on Xamarin Forms?

当我拍摄保存图像的照片时,它会显示子布局选择"Retry" 或"OK" 图像。我不想显示它。

我在 Xamarin Forms 上使用库 Plugin.Media,我的代码:

处理程序事件单击按钮捕获:

    private void CaptureImageCommandHandler()
    {
        Device.BeginInvokeOnMainThread(async () =>
        {
            try
            {
                await CheckPermissionCamera();

                if (Images == null)
                    Images = new ObservableCollection<string>();

                // Create a temp image. It'll be detelted after upload this temp image
                var path = await MediaManagement.TakePhoto();
                if (path == null)
                    return;

                // Add image
                AddImage(path, Localization.Resource.Photo);
            }
            catch (Exception ex)
            {
                Logger.Exception(ex);
            }
        });
    }

方法代码TakePhoto():

    public async Task<string> TakePhoto(float? width = null, float? height = null)
    {
        try
        {
            await CrossMedia.Current.Initialize();
            var mediaFile = await CrossMedia.Current.TakePhotoAsync(new StoreCameraMediaOptions());
            if (mediaFile?.Path == null)
                return null;

            // This is: Taking a photo action
            var result = await ResizeImageFile(mediaFile.Path, width, height, true).ConfigureAwait(false);
            return result;
        }
        catch (Exception)
        {
            return null;
        }
    }

这是页面图片。

请帮帮我!

谢谢!

根据 ,您不能使用 Plugin.Media。

This plugin use the standard way of capturing photos in Android which rely on the device actual camera app. The save/retry functionality is part of the Camera App and we don't have access to it as this will be different between Android "providers".

这意味着您需要找到解决此问题的方法。但是这个答案中也有一个 link ,可以帮助你。希望对您有所帮助!