/// <summary> /// Obtiene la descripción de una canción específica. /// </summary> /// <param name="track">Nombre de la canción.</param> /// <param name="artist">Nombre del artista o grupo.</param> /// <returns>Una descripción (si existe) de la canción buscada.</returns> public async Task <MTrack> GetTrackInfo(string track, string artist) { MTrack result = null; string response = await WebApiService.GetAsync(new Uri(string.Format(Settings.Servers.TrackInfoUrl, track, artist), UriKind.Absolute)); if (!string.IsNullOrEmpty(response)) { try { if (!response.Contains("error")) { result = new MTrack(); var artistInfo = JObject.Parse(response).SelectToken("track").ToString(); result = WebApiService.Deserialize <MTrack>(artistInfo); } } catch (Exception ex) { Debug.WriteLine(ex.Message); } } return(result); }
public static TrackDetailFragment NewInstance(MTrack selectedTrack) { var detailsFrag = new TrackDetailFragment { Arguments = new Bundle() }; detailsFrag.Arguments.PutString("current_track", JsonConvert.SerializeObject(selectedTrack)); return(detailsFrag); }
/// <summary> /// Se ejecuta al inicio para obtener los parámetros enviados desde TrackViewModel /// </summary> /// <param name="track">Canción seleccionado.</param> public async void Init(MTrack SelectedTrack) { if (SelectedTrack == null || string.IsNullOrEmpty(SelectedTrack.Name) || string.IsNullOrEmpty(SelectedTrack.ArtistName)) { return; } this.TrackParam = SelectedTrack; await LoadTrackDetail(); }
public MTrack LoadMidi(string fileName) { MTrack track = new MTrack("meta"); MidiSequence = new Sequence(); MidiSequence.Load(fileName); return(track); }
public MusicPlayerPage(MTrack track, IEnumerable <MTrack> tracks, Image coverImage) { InitializeComponent(); ObservableCollection <MTrack> queue = null; if (tracks != null) { queue = new ObservableCollection <MTrack>(tracks); } BindingContext = model = new MusicPlayerVM(track, queue, coverImage); }
/// <summary> /// Obtiene información de la canción seleccionado en la pantalla anterior. /// </summary> /// <returns></returns> public async Task LoadTrackDetail() { IsLoading = true; var data = await DataService.GetTrackInfo(TrackParam.Name, TrackParam.ArtistName); if (data != null) { data.Image = TrackParam.Image; Track = new MTrack(); Track = data; } else { ErrorMsg = "No se encontraron resultados para ésta búsqueda"; IsErrorMsgVisible = true; } IsLoading = false; }
private void btnAddSong_Click(object sender, EventArgs e) { try { var selectedRow = dgvAllSongs.CurrentRow; if (!albumTracks.Select(i => i.TrackID).ToList().Contains(Convert.ToInt32(selectedRow.Cells["TrackID"].Value))) { var track = new MTrack() { TrackID = Convert.ToInt32(selectedRow.Cells["TrackID"].Value), Name = Convert.ToString(selectedRow.Cells["Name"].Value), Length = Convert.ToString(selectedRow.Cells["Length"].Value) }; albumTracks.Add(track); } LoadListAlbumTracks(); } catch (Exception exception) { MessageBox.Show(exception.Message); } }
public static bool Remove(MTrack item) { var itemToRemove = LikedTracks.Where(i => i.TrackID == item.TrackID).FirstOrDefault(); return(LikedTracks.Remove(itemToRemove)); }