private void spotifyToolStripMenuItem_Click(object sender, EventArgs e) { Album a = Programa.miColeccion.devolverAlbum(vistaAlbumes.SelectedIndices[0]); //it f*****g works! no es O(1) Log.ImprimirMensaje(a.ToString(), TipoMensaje.Info); if (string.IsNullOrEmpty(a.IdSpotify)) { SpotifyAPI.Web.Models.SimpleAlbum album = Programa._spotify.DevolverAlbum(a.GetTerminoBusqueda()); if (a == null || album == null) { Log.ImprimirMensaje("Album fue nulo", TipoMensaje.Error); } else { SpotifyAPI.Web.Models.ErrorResponse err = Programa._spotify.ReproducirAlbum(album.Id); if (err != null && err.Error != null) { Log.ImprimirMensaje(err.Error.Message, TipoMensaje.Error, "spotifyToolStripMenuItem_Click()"); MessageBox.Show(err.Error.Message); } else { Log.ImprimirMensaje("Reproducción correcta", TipoMensaje.Correcto); } } } else { SpotifyAPI.Web.Models.ErrorResponse err = Programa._spotify.ReproducirAlbum(a.IdSpotify); if (err != null && err.Error != null) { Log.ImprimirMensaje(err.Error.Message, TipoMensaje.Error, "spotifyToolStripMenuItem_Click()"); MessageBox.Show(err.Error.Message); } else { Log.ImprimirMensaje("Reproducción correcta", TipoMensaje.Correcto); } } }
private void reproducirspotifyToolStripMenuItem_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(albumAVisualizar.IdSpotify)) { Cancion seleccion = albumAVisualizar.getCancion(vistaCanciones.SelectedItems[0].Index); if (!(seleccion is CancionLarga)) { SpotifyAPI.Web.Models.ErrorResponse err = Programa._spotify.ReproducirCancion(albumAVisualizar.IdSpotify, vistaCanciones.SelectedItems[0].Index); if (err.Error != null && err.Error.Message != null) { MessageBox.Show(err.Error.Message); } } else { CancionLarga cl = (CancionLarga)seleccion; SpotifyAPI.Web.Models.ErrorResponse err = Programa._spotify.ReproducirCancion(albumAVisualizar.IdSpotify, cl); if (err.Error != null && err.Error.Message != null) { MessageBox.Show(err.Error.Message); } } } }