Ejemplo n.º 1
0
        private async void PlayAll_Click(object sender, RoutedEventArgs e)
        {
            List <Song>       list         = listOfSongs.DataContext as List <Song>;
            MediaPlaybackList playbacklist = await MediaHelper.GetPlaybackList(list);

            playbacklist.ShuffleEnabled    = true;
            MediaHelper.MediaPlayer.Source = playbacklist;
        }
Ejemplo n.º 2
0
        private async void PlaySong_Click(object sender, RoutedEventArgs e)
        {
            DependencyObject iterator = sender as DependencyObject;

            while (!(iterator is ListViewItem))
            {
                iterator = VisualTreeHelper.GetParent(iterator);
            }
            DependencyObject parent = VisualTreeHelper.GetParent(iterator);
            Panel            panel  = parent as Panel;
            int         index       = panel.Children.IndexOf(iterator as UIElement);
            List <Song> list        = listOfSongs.DataContext as List <Song>;
            List <Song> songToPlay  = new List <Song>();

            songToPlay.Add(list[index]);
            MediaPlaybackList playbackList = await MediaHelper.GetPlaybackList(songToPlay);

            MediaHelper.MediaPlayer.Source = playbackList;
        }