When I take Photo that save image, It will display sub layout choose "Retry" or "OK" for image. I don't want display it.
I use library Plugin.Media on Xamarin Forms and my code:
Handler event click button capture:
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);
}
});
}
Code of method 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;
}
}
This is image of page.
Please help me!
Thanks!