Beispiel #1
0
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            switch (item.ItemId)
            {
            case Resource.Id.addToFavorite:
                API.AddToFavoriteAsync(idRestaurant);
                Preferences.Set("boolFavorite", false);
                Toast.MakeText(this, "Restaurante añadido a favoritos", ToastLength.Short).Show();
                return(true);

            case Resource.Id.shareRestaurant:

                string share = $"Restaurante: {restaurant.name}\n" +
                               $"Ubicación: {restaurant.address}\n" +
                               $"Cocina: {restaurant.idcategoriesNavigation.category}\n" +
                               $"Calificación de Mr.Piatto: {restaurant.score}\n" +
                               $"Contacto: {restaurant.phone}";
                Share.RequestAsync(new ShareTextRequest
                {
                    Text  = share,
                    Title = "Compartir información"
                });
                return(true);

            case Resource.Id.mailSubscriptions:
                var msg = API.MailSubscription(Preferences.Get("idUser", 0), idRestaurant);
                Toast.MakeText(this, msg, ToastLength.Short).Show();
                return(true);

            default:
                return(base.OnOptionsItemSelected(item));
            }
        }