Ejemplo n.º 1
0
        private void treeView1_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            axWindowsMediaPlayer1.Ctlcontrols.stop();

            TreeNode selnode = e.Node;
            int i = selnode.Index;
            string[] s = new string[list[i].Items.Count];
            lb2.Items.Clear();
            listView2.Items.Clear();
            listView1.Items.Clear();
            ds.Items.Clear();

            for (int j = 0; j < list[i].Items.Count; j++)
            {
                s[j] = list[i].Items[j].ToString();
                lb2.Items.Add(s[j]);
                listView2.Items.Add(Path.GetFileNameWithoutExtension(s[j]));
            }

            plItems = axWindowsMediaPlayer1.playlistCollection.getByName(myPlaylist);
            if (plItems.count == 0)
            {
                pl = axWindowsMediaPlayer1.playlistCollection.newPlaylist(myPlaylist);
            }
            else
            {
                pl = plItems.Item(0);
            }
            int q = 0;
            foreach (string file in s)
            {
                ListViewItem item = new ListViewItem(s[q]);
                ds.Items.Add(Path.GetFileNameWithoutExtension(item.ToString()));
                q++;
                m1 = axWindowsMediaPlayer1.newMedia(file);
                pl.appendItem(m1);
            }

            //choi nhac
            axWindowsMediaPlayer1.currentPlaylist = pl;
            axWindowsMediaPlayer1.Ctlcontrols.play();
            axWindowsMediaPlayer1.playlistCollection.remove(pl);
        }
Ejemplo n.º 2
0
        private void CreatePlayLis(OpenFileDialog open, ListView lv)
        {
            plItems = axWindowsMediaPlayer1.playlistCollection.getByName(myPlaylist);

            if (plItems.count == 0)
                pl = axWindowsMediaPlayer1.playlistCollection.newPlaylist(myPlaylist);
            else
                pl = plItems.Item(0);

            //them vao listview va thu vien WMP

            int i = 0;
            foreach (string file in open.FileNames)
            {
                ListViewItem item = new ListViewItem(open.FileNames[i]);
                lv.Items.Add(Path.GetFileNameWithoutExtension(item.ToString()));
                i++;
                m1 = axWindowsMediaPlayer1.newMedia(file);
                pl.appendItem(m1);
            }

            //choi nhac
            axWindowsMediaPlayer1.currentPlaylist = pl;
            axWindowsMediaPlayer1.Ctlcontrols.play();
            axWindowsMediaPlayer1.playlistCollection.remove(pl);
        }