public AlbumDetailVM(MAlbum album) { Album = album; InitCommand = new Command(async() => await InitTrack()); DeleteCommand = new Command <MComment>(async(comment) => await Delete(comment)); AddCommand = new Command(async() => await Add()); }
public AlbumDetailPage(MAlbum album) { InitializeComponent(); BindingContext = model = new AlbumDetailVM(this.Navigation) { Album = album }; }
/// <summary> /// Se ejecuta al inicio para obtener los parámetros enviados desde AlbumViewModel. /// </summary> /// <param name="album">Álbum seleccionado,</param> public async void Init(MAlbum album) { if (album == null || string.IsNullOrEmpty(album.Name) || string.IsNullOrEmpty(album.Artist)) { return; } this.AlbumParam = album; await LoadAlbumDetail(); }
public PaymentPage(MAlbum album) { InitializeComponent(); var nav = new NavigationPage(new AlbumPage()); navigation = nav.Navigation; BindingContext = model = new PaymentVM(navigation) { Album = album }; }
/// <summary> /// Obtiene información del álbum seleccionado en la pantalla anterior. /// </summary> /// <returns></returns> private async Task LoadAlbumDetail() { IsLoading = true; var data = await DataService.GetAlbumInfo(AlbumParam.Name, AlbumParam.Artist); if (data != null) { Album = new MAlbum(); Album = data; Album.Image = AlbumParam.Image; } else { ErrorMsg = "No se encontraron resultados para ésta búsqueda."; IsErrorMsgVisible = true; } IsLoading = false; }
private async void AlbumUpsert_Load(object sender, EventArgs e) { var artists = await artistService.Get <List <MArtist> >(null); var genres = await genreService.Get <List <MGenre> >(null); cbArtist.DataSource = artists; cbArtist.ValueMember = "ArtistID"; cbArtist.DisplayMember = "Name"; cbGenre.DataSource = genres; cbGenre.ValueMember = "GenreID"; cbGenre.DisplayMember = "Name"; await LoadListAllTracks(); if (_ID.HasValue) { _album = await albumService.GetById <MAlbum>(_ID.Value); txtName.Text = _album.Name; txtReleaseYear.Text = _album.YearOfRelease.ToString(); txtPrice.Text = _album.Price.ToString(); txtAbout.Text = _album.About; if (_album.Image.Length > 3) { pbAlbumPicture.Image = ImageHelper.ByteArrayToSystemDrawing(_album.Image); pbAlbumPicture.SizeMode = PictureBoxSizeMode.StretchImage; } cbArtist.SelectedItem = artists.Where(i => i.ArtistID == _album.ArtistID).SingleOrDefault(); cbGenre.SelectedItem = genres.Where(i => i.GenreID == _album.GenreID).SingleOrDefault(); albumTracks = await albumService.GetTracks <List <MTrack> >(_ID.Value, null); LoadListAlbumTracks(); } else { DGVHelper.PopulateWithList(dgvAlbumSongs, albumTracks, temp); } }
/// <summary> /// Obtiene la descripción de un álbum específico. /// </summary> /// <param name="album">Nombre del álbum.</param> /// <param name="artist">Nombre del artista.</param> /// <returns>Una descripción (si existe) del álbum buscado.</returns> public async Task <MAlbum> GetAlbumInfo(string album, string artist) { MAlbum result = null; string response = await WebApiService.GetAsync(new Uri(string.Format(Settings.Servers.AlbumInfoUrl, album, artist), UriKind.Absolute)); if (!string.IsNullOrEmpty(response)) { try { if (!response.Contains("error")) { result = new MAlbum(); JObject jresult = null; jresult = JObject.Parse(response); result.Tracks = new List <MTrack>(); foreach (JToken item in jresult.SelectToken("album").SelectToken("tracks").SelectToken("track").Children()) { result.Tracks.Add(item.ToObject <MTrack>()); } result.Name = jresult.SelectToken("album").SelectToken("name").Value <string>(); result.Artist = jresult.SelectToken("album").SelectToken("artist").Value <string>(); result.Images = new List <MImage>(jresult.SelectToken("album").SelectToken("image").ToObject <List <MImage> >()); result.Image = result.Images[3].Url; if (jresult.SelectToken("album").SelectToken("wiki") != null) { result.Wiki = jresult.SelectToken("album").SelectToken("wiki").ToObject <MBiography>(); } } } catch (Exception ex) { Debug.WriteLine(ex.Message); } } return(result); }
public YourAlbumDetailPage(MAlbum album) { InitializeComponent(); BindingContext = model = new YourAlbumDetailVM(album); }
public ArtistAlbumPage(MAlbum album) { InitializeComponent(); BindingContext = model = new AlbumDetailVM(album); }
public AlbumVM(MAlbum album) { Album = album; }
public YourAlbumDetailVM(MAlbum album) { Album = album; }