示例#1
0
        private void AlbumAdapter_ItemClick(object sender, RecyclerViewAdapterClickEventArgs e)
        {
            APIGatewayService api       = new APIGatewayService();
            List <Cancion>    canciones = new List <Cancion>();

            try
            {
                canciones = api.ObtenerCancionesPorIdAlbum(e.Album.Id);
            }
            catch (Exception ex)
            {
                canciones = new List <Cancion>();
                Toast.MakeText(View.Context, "Error al cargar canciones.", ToastLength.Short);
            }

            canciones.ForEach(c =>
            {
                try
                {
                    c.Artistas = api.ObtenerArtistasPorIdCancion(c.Id);
                }
                catch (Exception ex)
                {
                    c.Artistas = new List <Artista>();
                    Toast.MakeText(View.Context, "No se pudo cargar canciones completamente.", ToastLength.Short);
                }

                c.Album = e.Album;
            });

            var listasFragment = new ListasFragment(canciones, e.Album.Nombre, e.Album.Ilustracion, Reproductor, Usuario, CambiarContenido);

            CambiarContenido.CambiarContenido(listasFragment);
        }
 void OnLongClick(RecyclerViewAdapterClickEventArgs args) => ItemLongClick?.Invoke(this, args);