Hola amigos tengo el siguiente problema, cuando llamo esta funcion mi vista se vuelve super lenta y me manda a esperar o cerrar alguien sabe a que se deba??
private MediaFile _image;
// este mediafile lo asigno con un evento de la camara
private async void btnCamara_Clicked(object sender, EventArgs e)
{
await CrossMedia.Current.Initialize();
if (!CrossMedia.Current.IsCameraAvailable || !CrossMedia.Current.IsTakePhotoSupported)
{
await DisplayAlert("No Camera", ":( No camera soportada.", "OK");
return;
}
_image = await CrossMedia.Current.TakePhotoAsync(new StoreCameraMediaOptions
{
Directory = "auto_" + idx,
Name = "auto.jpg"
});
if (_image == null)
return;
var xlocal = _image.Path;
imgx.Source = ImageSource.FromStream(() => {
return _image.GetStream(); });
//_image.Path
_ = b64img();
}
//
private async Task b64img() {
try
{
byte[] b = System.IO.File.ReadAllBytes(_image.Path);
String s = Convert.ToBase64String(b);
b64.Text = s;
colorx.IsVisible = false;
btnCamara.IsVisible = false;
btnGal.IsVisible = false;
}
catch (Exception ex)
{
await DisplayAlert("error", ex.ToString(), "ok");
}
}
la llamo cuando termino otro metodo con un _ = b64img();
_ = b64img()
por favor?