public DeletePlaylist(Form1 form, DataSet1 dataset, AxWindowsMediaPlayer mp)
        {
            InitializeComponent();

            this.otherForm = form;
            this.dataset = dataset;
            manager = new PlayListManager(dataset);
            this.mp = mp;
        }
        public RenamePlaylist(Form1 form, DataSet1 dataset, AxWindowsMediaPlayer mp)
        {
            InitializeComponent();

            this.otherForm = form;
            this.dataset   = dataset;
            manager        = new PlayListManager(dataset);
            this.mp        = mp;
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            manager = new PlayListManager(dataset);
            List <string> playlists = manager.LoadPlaylists();

            openToolStripMenuItem.DropDownItems.Clear();
            foreach (var item in playlists.OrderBy(playlistName => playlistName))
            {
                ToolStripMenuItem tsmi = CreateOpenMenuItem(item);
                openToolStripMenuItem.DropDownItems.Add(tsmi);
            }
        }
        //add song to current playlist
        private void addToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(CurrentPlayList))
            {
                MessageBox.Show("Select playlist first!");
            }
            else
            {
                OpenFileDialog ofd = new OpenFileDialog();
                ofd.Filter      = "Media Files|*.mpg;*.avi;*.wma;*.mov;" + "*.wav;*.mp2;*.mp3|All Files|*.*";
                ofd.Multiselect = true;

                try
                {
                    //List<PlayListItem> items = new List<PlayListItem>();
                    Dictionary <string, string> dsfsd = new Dictionary <string, string>();

                    if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        //string songName = Path.GetFileName(ofd.FileName);
                        //path = ofd.FileName;
                        //IWMPMedia media = xWMP.newMedia(path);

                        //xWMP.URL = path;

                        ////defaultPlaylist.appendItem(media);
                        //PlayListItem item = PlayListManager.CreateItem(songName, path);
                        //items.Add(item);
                        //totalD = media.durationString;
                        //if (totalD.Length < 6)
                        //{
                        //    totalD = "00:" + totalD;
                        //}
                        //TotalDuration += TimeSpan.Parse(totalD);
                        //lbl_totalDuration.Text = TotalDuration.ToString();
                        //addItemToListView(songName, totalD, path);

                        //dsfsd.Add(path, songName);
                        //manager.AddSongsToPlayList(dsfsd, CurrentPlayList);

                        List <PlayListItem> items    = new List <PlayListItem>();
                        IWMPPlaylist        playlist = xWMP.playlistCollection.getByName(CurrentPlayList).Item(0);

                        foreach (string path in ofd.FileNames)
                        {
                            IWMPMedia media = xWMP.newMedia(path);
                            //xWMP.URL = path;
                            PlayListItem item = PlayListManager.CreateItem(Path.GetFileName(path), path);
                            items.Add(item);
                            playlist.appendItem(media);
                            totalD = media.durationString;
                            if (totalD.Length < 6)
                            {
                                totalD = "00:" + totalD;
                            }
                            TotalDuration         += TimeSpan.Parse(totalD);
                            lbl_totalDuration.Text = TotalDuration.ToString();

                            addItemToListView(Path.GetFileName(path), totalD, path);

                            //dsfsd.Add(path, Path.GetFileName(path));
                        }
                        Dictionary <string, string> nameUrlPair = items.ToDictionary(t => t.Path, t => t.Name);
                        manager.AddSongsToPlayList(nameUrlPair, CurrentPlayList);
                        LoadPlayList(CurrentPlayList);
                    }
                }
                catch (ArgumentException ex)
                {
                    MessageBox.Show(ex.Message.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            manager = new PlayListManager(dataset);
            List<string> playlists = manager.LoadPlaylists();

            openToolStripMenuItem.DropDownItems.Clear();
            foreach (var item in playlists.OrderBy(playlistName => playlistName))
            {
                ToolStripMenuItem tsmi = CreateOpenMenuItem(item);
                openToolStripMenuItem.DropDownItems.Add(tsmi);
            }
        }