Esempio n. 1
0
        public ConsultaCanciones()
        {
            InitializeComponent();

            btnBuscarAutorNombre.Clicked += async(sender, e) =>
            {
                // Busqueda por autor y nombre
                string art, can;
                art = txtArtista.Text;
                can = txtCancion.Text;
                if (art == null || art.Length < 4)
                {
                    await DisplayAlert("Error en entrada", "Debe introducir al menos 4 caracteres en el autor", "Entendido");

                    return;
                }
                if (can == null || can.Length < 4)
                {
                    await DisplayAlert("Error en entrada", "Debe introducir al menos 4 caracteres en la canción", "Entendido");

                    return;
                }
                // Obtener la lista de canciones
                LyricsWS lyricsWS = new LyricsWS();
                List <SearchLyricResult> lista = await lyricsWS.ListSongs(art, can);

                // Mostrar el resultado
                showResult(lista);
            };

            btnBuscarLetra.Clicked += async(sender, e) =>
            {
                // Búsqueda por letra
                string let;
                let = txtLetra.Text;
                if (let == null || let.Length < 4)
                {
                    await DisplayAlert("Error en entrada", "Debe introducir al menos 4 caracteres", "Entendido");

                    return;
                }
                // Obtener la lista de canciones
                LyricsWS lyricsWS = new LyricsWS();
                List <SearchLyricResult> lista = await lyricsWS.ListSongs(let);

                // Mostrar el resultado
                showResult(lista);
            };
        }
Esempio n. 2
0
        public ListaResultados(List <SearchLyricResult> lista)
        {
            InitializeComponent();
            resultList.ItemsSource = lista;

            resultList.ItemSelected += async(sender, e) =>
            {
                var item = e.SelectedItem as SearchLyricResult;
                //await DisplayAlert("Seleccionado", "elemento seleccionado: " + item.ToString(), "Entendido");
                // Crear nueva canción
                SearchLyricResult search      = item;
                LyricsWS          lyricsWS    = new LyricsWS();
                GetLyricResult    lyricResult = await lyricsWS.GetSong(search.lyricId, search.lyricChecksum);

                Song song = new Song(lyricResult);
                // Pasarla
                await Navigation.PushAsync(new DetalleCancion(song, true));
            };
        }