Error "Signature (return type) of EventHandler ..."

1

Giving the error:

Signature (return type) of EventHandler "FoodSuppy.Tele.Application.BtnInclude_Clicked" does not match the event type FoodSuppy.

The buttons in my application started to give this message after I updated the NuGet packages. I would like to know how to solve it.

Follow the code below:

//Botão Incluir
        private async Task BtnIncluir_Clicked(object sender, EventArgs e)
        {
            //Enviar ao banco
            Retorno retorno = await BuscarSolicitacaoCompras.BuscaInformacao("1", 0);

            await Navigation.PushAsync(new ItensCompra(Convert.ToString(retorno.ID_RET), "Incluir"));

            AtualizaDados(usuario);
        }

The code that is bound to the button is this:

//Buscar Solicitação de Compra
    class BuscarSolicitacaoCompras
    {
        private static Login1 usuarioConectado = new Login1();

        private static readonly string UrlBase = "http://sibrati.com.br/foodsupply/ie_solcompra.php?op={0}&idu={1}&ids={2}";

        public async static Task<Retorno> BuscaInformacao(string op, int ids)
        {
            usuarioConectado = Conectado.Pegar_ClienteConectado();

            string URL = string.Format(UrlBase, op, usuarioConectado.ID_USUARIO, ids);

            HttpClient http = new HttpClient();

            var response = await http.GetAsync(URL);
            var content = await response.Content.ReadAsStringAsync();
            var retorno = JsonConvert.DeserializeObject<Retorno>(content);

            return retorno;
        }
    }
    
asked by anonymous 19.09.2018 / 20:30

1 answer

1
  

Events of any kind do not return values, they are "void". He is   complaining that BtnIncluir_Clicked is not compatible with    EventHandler , which has the following signature:

public void Método(object sender, EventArgs e);
     

This is due to the existence of the Task return. Try to put void   and see if the compiler accepts.

With this response from a partner, I simply changed Task to void :

private async void BtnIncluir_Clicked(object sender, EventArgs e)
{
   ...
}
    
20.09.2018 / 13:38