예제 #1
0
        private async Task LoadListTracks()
        {
            var list = await trackService.Get <List <MTrack> >(null);

            dgvAllTracks.ReadOnly = true;
            DGVHelper.PopulateWithList(dgvAllTracks, list, temp);
        }
예제 #2
0
        private async void PlaylistUpsert_Load(object sender, EventArgs e)
        {
            await LoadListTracks();

            if (ID.HasValue)
            {
                _playlist = await playlistService.GetById <MPlaylist>(ID.Value);

                txtName.Text = _playlist.Name;
                txtUser.Text = _playlist.User.Username;

                if (_playlist.Image.Length > 3)
                {
                    pbPlaylistPicture.Image    = ImageHelper.ByteArrayToSystemDrawing(_playlist.Image);
                    pbPlaylistPicture.SizeMode = PictureBoxSizeMode.StretchImage;
                }

                playlistTracks = await playlistService.GetTracks <List <MTrack> >(ID.Value, null);

                LoadListPlaylistTracks();
            }
            else
            {
                DGVHelper.PopulateWithList(dgvPlaylistTracks, playlistTracks, temp);
            }
        }
예제 #3
0
        private void LoadListPlaylistTracks()
        {
            var list = playlistTracks;

            if (list.Count > 0)
            {
                dgvPlaylistTracks.ColumnCount = 0;
                dgvPlaylistTracks.ReadOnly    = true;
                DGVHelper.PopulateWithList(dgvPlaylistTracks, list, temp);
            }
        }
예제 #4
0
        private void LoadListAlbumTracks()
        {
            var list = albumTracks;

            if (list.Count > 0)
            {
                dgvAlbumSongs.ColumnCount = 0;
                dgvAlbumSongs.ReadOnly    = true;
                DGVHelper.PopulateWithList(dgvAlbumSongs, list, temp);
            }
        }
예제 #5
0
        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);
            }
        }