示例#1
0
        //Add new Playlist Methods
        //Open Window to create new Playlist
        private void AddList_Click(object sender, RoutedEventArgs e)
        {
            _userId = MainWindow.UserId;

            string NewPlaylistName = PlaylistNameBox.Text;

            if (!string.IsNullOrWhiteSpace(NewPlaylistName))
            {
                Playlist NewPlaylist = new Playlist();
                NewPlaylist.P_Name = NewPlaylistName;
                _sqlAccess.AddPlaylist(NewPlaylist, _userId);
                Dispatcher.BeginInvoke(new Action(delegate()
                {
                    _songList = _sqlAccess.GetSongsForUser(_userId);
                    SongDataGrid.ItemsSource = _songList;
                    _playlistList            = _sqlAccess.GetPlaylistsForUser(_userId);
                    PlaylistBox.ItemsSource  = _playlistList;
                }));
                PlaylistNameBox.Text         = "";
                AddPlayistSection.Visibility = Visibility.Collapsed;
            }
        }