new private async void Load() { song = new Song(); SongCategories = await _songCategoryService.GetAll(); cbbCategory.DataSource = SongCategories; cbbCategory.DisplayMember = "DisplayName"; }
private async void LoadDetail() { LyricLabel = new List <Label>(); lblSongName.Text = Song.DisplayName; lblSongName.Left = this.Width / 2 - lblSongName.Width / 2; var request = WebRequest.Create(Song.Thumbnail); using (var response = request.GetResponse()) using (var stream = response.GetResponseStream()) { thumbnailMain = UIHelper.ClipToCircle(Bitmap.FromStream(stream), Constants.FOOTER_BACKGROUND); imgThumbnail.BackgroundImage = thumbnailMain; } lblCategory.Text = (await _songCategoryService.GetAll()).FirstOrDefault(c => c.ID == Song.CategorySongID)?.DisplayName ?? "Không xác định"; lblPerformer.Text = Song.Performer; lblArtistsNames.Text = Song.ArtistsNames; // Get lyric HttpClient client = new HttpClient(); var dataString = await client.GetStringAsync(Song.Lyric); Lyrics = dataString.Split('\n').ToList().Select(m => { return(new LyricLine() { // max = 68 Time = ConvertToSecond(m.Substring(1, 8)), Line = m.Substring(11) }); }).ToList(); foreach (var item in Lyrics) { var lbl = new Label(); lbl.AutoSize = false; lbl.Width = flpLyrics.Width - 40; lbl.Height = 55; lbl.Padding = new Padding(0, 0, 0, 0); lbl.Margin = new Padding(0, 0, 0, 0); lbl.Text = item.Line; lbl.ForeColor = Color.FromArgb(202, 202, 202); lbl.Font = new Font("Consolas", 14, FontStyle.Bold); lbl.TextAlign = ContentAlignment.MiddleCenter; lbl.Tag = item.Time; lbl.Cursor = Cursors.Hand; lbl.Click += Lbl_Click; flpLyrics.Controls.Add(lbl); LyricLabel.Add(lbl); } }
public async Task Load() { Songs = await _songService.GetAll(); SongCategories = await _songCategoryService.GetAll(); CategoryListActive = new List <int>(); PlaylistItemUCMockData = new List <PlaylistItemUC>(); LoadCategory(); SetStatusFilter(false); LoadPlaylistItem(new Action <bool>(SetStatusFilter)); }
new public async Task Load() { Songs = await _songService.GetAll(); SongCategories = new Dictionary <int, string>(); foreach (var item in await _songCategoryService.GetAll()) { SongCategories.Add(item.ID, item.DisplayName); } LoadListView(); if (Songs.Count > 0) { CurrentSong = Songs[0]; LoadDetail(); } }
// Load item from Static new public async Task Load() { flpPlaylist.Size = new Size(flpPlaylist.Size.Width, flpPlaylist.Size.Height + 300); flpFavoriteList.Size = new Size(flpFavoriteList.Size.Width, flpFavoriteList.Size.Height + 300); Songs = await _songService.GetAll(); SongCategories = await _songCategoryService.GetAll(); CategoryListActive = new List <int>(); PlaylistItemPUCMockData = new List <PlaylistItemPUC>(); LoadCategory(); SetStatusFilter(false); LoadPlaylistItem(new Action <bool>(SetStatusFilter)); }
private async void LoadDetail() { var categories = await _songCategoryService.GetAll(); lblDisplayName.Text = song.DisplayName; txtDisplayName.Text = song.DisplayName; cbbCategory.DataSource = categories; cbbCategory.DisplayMember = "DisplayName"; cbbCategory.SelectedIndex = categories.IndexOf(categories.FirstOrDefault(c => c.ID == song.CategorySongID)); txtTitle.Text = song.Title; txtArtistName.Text = song.ArtistsNames; txtPerformer.Text = song.Performer; var request = WebRequest.Create(song.Thumbnail); using (var response = request.GetResponse()) using (var stream = response.GetResponseStream()) { imgThumbnail.BackgroundImage = Bitmap.FromStream(stream); } }
public async Task <IEnumerable <SongCategory> > GetAll() { var categories = await _categoryService.GetAll(); return(categories); }
public IEnumerable <SongCategoryModel> Get() { return(_songCategoryService.GetAll()); }