예제 #1
0
 public void PlaylistCreate()
 {
     var library = Library.Load();
     Playlist pl;
     try
     {
         pl = new Playlist(library, "TestPlaylist 1");
     }
     catch
     {
         Assert.Fail();
     }
 }
예제 #2
0
        public void PlaylistSaveSingle()
        {
            var library = Library.Load();
            Playlist pl = new Playlist(library, "TestPlaylist 1");
            pl.Add(library.GetSongs());

            try
            {
                pl.Save();
            }
            catch
            {
                Assert.Fail();
            }
        }
예제 #3
0
        public void PlaylistSaveMany()
        {
            var library = Library.Load();
            Playlist pl = new Playlist(library, "TestPlaylist 2");

            for (int i = 0; i < 10; i++)
                pl.Add(library.GetSongs());

            try
            {
                pl.Save();
            }
            catch
            {
                Assert.Fail();
            }
        }
예제 #4
0
파일: MainForm.cs 프로젝트: koaset/KoPlayer
        private void playlistGridView_CellValidating(object sender, DataGridViewCellValidatingEventArgs e)
        {
            if (renamingPlaylist == null)
                return;

            string currentName = e.FormattedValue.ToString();

            string oldName = this.renamingPlaylist.Name;
            string oldPath = this.renamingPlaylist.Path;

            if (string.IsNullOrEmpty(currentName))
                e.Cancel = true;
            else
            {
                foreach (PlaylistBase pl in playlists)
                {
                    if (currentName.ToLower() == pl.Name.ToLower())
                        if (currentName.ToLower() != oldName.ToLower())
                        {
                            e.Cancel = true;
                            break;
                        }
                }
            }

            // save change file name as well
            if (!e.Cancel)
            {
                if (currentName.ToLower() != oldName.ToLower())
                {
                    renamingPlaylist.Name = currentName;
                    try
                    {
                        if (File.Exists(oldPath))
                            System.IO.File.Move(oldPath, renamingPlaylist.Path);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Playlist rename exception: " + ex.Message);
                    }
                }

                renamingPlaylist = null;
            }
        }
예제 #5
0
파일: MainForm.cs 프로젝트: koaset/KoPlayer
        private void CreateNewPlaylist()
        {
            string name = GetNewPlaylistName(false);

            var newPlaylist = new Playlist(library, name);
            playlists.Add(newPlaylist);
            SetPlaylistGridView();
            ChangeToPlaylist(newPlaylist);
        }
예제 #6
0
파일: MainForm.cs 프로젝트: koaset/KoPlayer
 private void RenamePlaylist()
 {
     renamingPlaylist = GetPlaylist(playlistGridView.CurrentCell.Value.ToString()) as Playlist;
     playlistGridView.BeginEdit(true);
 }