/// <summary> /// Mở control custom playlist /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void LvCustomPlaylist_SelectionChanged(object sender, SelectionChangedEventArgs e) { MainGrid.Children.Clear(); int index = lvCustomPlaylist.SelectedIndex; if (index >= 0) { Playlist p = customplaylist[index]; selectedPlaylist = p; var CustomPlaylistController = new CustomPlaylistControl(ref p); MainGrid.Children.Add(CustomPlaylistController); CustomPlaylistController.PlayAllClick += CustomPlaylistController_PlayAllClick; CustomPlaylistController.SavePlaylistClick += CustomPlaylistController_SavePlaylistClick; } }
private void CrawlZingMp3(object sender, RoutedEventArgs e) { CrawlZingMp3 crawler = new CrawlZingMp3(); if (ZingMp3Playlist.Songs == null) { Thread thread = new Thread(() => { ZingMp3Playlist = crawler.createAlbum(); Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => { MainGrid.Children.Clear(); var CustomPlaylistController = new CustomPlaylistControl(ref ZingMp3Playlist); selectedPlaylist = ZingMp3Playlist; MainGrid.Children.Add(CustomPlaylistController); CustomPlaylistController.PlayAllClick += CustomPlaylistController_PlayAllClick; CustomPlaylistController.SavePlaylistClick += CustomPlaylistController_SavePlaylistClick; BusyBar.IsBusy = false; })); }); thread.IsBackground = true; thread.Start(); BusyBar.IsBusy = true; } else { MainGrid.Children.Clear(); var CustomPlaylistController = new CustomPlaylistControl(ref ZingMp3Playlist); selectedPlaylist = ZingMp3Playlist; MainGrid.Children.Add(CustomPlaylistController); CustomPlaylistController.PlayAllClick += CustomPlaylistController_PlayAllClick; CustomPlaylistController.SavePlaylistClick += CustomPlaylistController_SavePlaylistClick; BusyBar.IsBusy = false; } }