Пример #1
0
        private async void PlaylistName_Click(object sender, RoutedEventArgs e)
        {
            // Get user selected songs
            List <Song> UserSelectedSongs = new List <Song>();
            var         Indexes           = listOfSongs.SelectedRanges;
            List <Song> Mainlist          = listOfSongs.DataContext as List <Song>;

            foreach (var index in Indexes)
            {
                int firstindex = index.FirstIndex;
                int lastindex  = index.LastIndex;
                UserSelectedSongs.AddRange(Mainlist.GetRange(firstindex, (int)index.Length));
            }

            // Get playlist name
            MenuFlyoutItem flyoutItem   = sender as MenuFlyoutItem;
            string         PlaylistName = flyoutItem.Text;

            // Create Playlist object : playlist name in which we have existing songs
            PlayList playList = await PlayList.GetPlayListFromFileAsync(PlaylistName);

            // Add selected songs in playlist
            playList.songs.AddRange(UserSelectedSongs);

            // Display Playlist object in PlaylistDisplay Page
            playList.WriteToFileAsync();
            Tuple <PlayList, Frame> tuple = new Tuple <PlayList, Frame>(playList, mainPageParams.CentreFrame);

            mainPageParams.CentreFrame.Navigate(typeof(PlaylistDisplay), tuple);
        }
Пример #2
0
        private async void PlaylistSelected(object sender, TappedRoutedEventArgs e)
        {
            string   playlistName = (sender as Microsoft.UI.Xaml.Controls.NavigationViewItem).Content.ToString();
            PlayList p            = await PlayList.GetPlayListFromFileAsync(playlistName);

            Tuple <PlayList, Frame> tuple = new Tuple <PlayList, Frame>(p, CentreFrame);

            CentreFrame.Navigate(typeof(PlaylistDisplay), tuple);
        }