Exemplo n.º 1
0
        public void DoRenamePlaylist(object sender, RoutedEventArgs args)
        {
            PlayList pl = PlaylistListBox.SelectedItems[0] as PlayList;
            SingleStringInputDialog ssid = new SingleStringInputDialog("Enter a new Playlist name", "Rename playlist");

            ssid.ShowDialog();
            if (ssid.DialogResult ?? false)
            {
                pl.Name = ssid.InputValue;
                //var plList = PlaylistListBox.ItemsSource as ObservableCollection<PlayList>;
                ParentWindow.UpdateLists();
                ParentWindow.AsyncSerialize(ParentWindow.BackgroundCallback);
            }
        }
Exemplo n.º 2
0
        public void DoRemoveSongFromPlayList(object sender, RoutedEventArgs args)
        {
            MessageBoxResult result = MessageBox.Show("Remove selected songs from playlist?", "Remove songs?", MessageBoxButton.YesNoCancel, MessageBoxImage.Warning);

            if (result == MessageBoxResult.Yes)
            {
                foreach (ListBox lb in InnerListBoxes)
                {
                    while (lb.SelectedItems.Count > 0)
                    {
                        (lb.ItemsSource as ObservableCollection <Song>).Remove(lb.SelectedItems[0] as Song);
                    }
                }
                ParentWindow.AsyncSerialize(ParentWindow.BackgroundCallback);
            }
        }
Exemplo n.º 3
0
        public void DoAddSelectedPlaylistsToNewPlayList(object sender, RoutedEventArgs args)
        {
            PlayList newPlaylist = new PlayList()
            {
                Name = "New Playlist"
            };

            foreach (PlayList pl in PlaylistListBox.SelectedItems)
            {
                foreach (Song s in pl.SongList)
                {
                    newPlaylist.SongList.Add(s);
                }
            }
            ParentWindow.SongLibrary.PlayListList.Add(newPlaylist);
            ParentWindow.UpdatePlayListContextMenuItems();
            ParentWindow.AsyncSerialize(ParentWindow.BackgroundCallback);
        }
Exemplo n.º 4
0
        public void DoAddSelectedSongsToNewPlayList(object sender, RoutedEventArgs args)
        {
            PlayList pl = new PlayList()
            {
                Name = "New Playlist"
            };

            foreach (ListBox lb in InnerListBoxes)
            {
                foreach (Song s in lb.SelectedItems)
                {
                    pl.SongList.Add(s);
                }
            }
            ParentWindow.SongLibrary.PlayListList.Add(pl);
            ParentWindow.UpdatePlayListContextMenuItems();
            ParentWindow.AsyncSerialize(ParentWindow.BackgroundCallback);
        }
Exemplo n.º 5
0
        public void DoDeletePlaylist(object sender, RoutedEventArgs args)
        {
            MessageBoxResult result = MessageBox.Show("Remove selected playlists from library?", "Remove playlists?", MessageBoxButton.YesNoCancel, MessageBoxImage.Warning);

            if (result == MessageBoxResult.Yes)
            {
                for (int i = 0; i < ParentWindow.SongLibrary.PlayListList.Count(); i++)
                {
                    if (ParentWindow.SongLibrary.PlayListList.Contains(PlaylistListBox.SelectedItems[i] as PlayList))
                    {
                        ParentWindow.SongLibrary.PlayListList.Remove(PlaylistListBox.SelectedItems[i] as PlayList);
                        i--;
                    }
                    if (PlaylistListBox.SelectedItems.Count <= 0)
                    {
                        break;
                    }
                }
                ParentWindow.UpdateLists();
                ParentWindow.AsyncSerialize(ParentWindow.BackgroundCallback);
            }
        }