private async void pressedPizza(object sender, EventArgs e) { PictureBox pb = (PictureBox)sender; String nombrepizza = pb.Name; Pizza p = await cp.buscarPizzaPorNombre(nombrepizza); addPizza(p); }
/// <summary> /// This method when you select an item from the list of pizzas puts the name in the corresponding text box and the price and selects the ingredients of the checkboxes that pertocan each pizza along with the image. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// private async void ListViewPizzas_SelectedIndexChanged(object sender, EventArgs e) { if (ListViewPizzas.SelectedItems.Count > 0) { //select the name of the pizza (item listview) ListViewItem listItem = ListViewPizzas.SelectedItems[0]; String nombrepizza = listItem.Text; txtNombrePizza.Text = nombrepizza; //take the price of the pizza and show it Pizza p = await cp.buscarPizzaPorNombre(nombrepizza); if (p != null) { txtPrecio.Text = p.getPrecio().ToString(); //we call the method marcaIngredientes to select the ingredients that takes the pizza idPizza = p.getIdPizza(); List <Ingrediente> listaIngredientes = cp.listarIngredientesPizza(idPizza.ToString()); marcarIngredientesPizza(listaIngredientes); //load image to the picturebox String pathImage = p.getImagen(); pictureBox1.ImageLocation = "http://provenapps.cat/~dam1804/Images/pizzas/" + pathImage; } else { Alert("No se ha encontrado ninguna pizza.", "Error"); } } }