Example #1
0
        private void frmTV_Load(object sender, EventArgs e)
        {
            try
            {
                synth.SetOutputToDefaultAudioDevice();

                // Obtener los videos de la carpeta \Video
                string strFolder = Common.Utils.GetApplicationExecutingFolder() + @"\" + PathVideo + "";
                string strSupportedExtensions = "*.wmv,*.mp4,*.avi"; // Solo Videos
                _lstBackGroundVideoFiles = Common.Utils.GetFolderFiles(strFolder, strSupportedExtensions);

                WMPLib.IWMPPlaylist PlayList = axWindowsMediaPlayer1.playlistCollection.newPlaylist("Video");

                foreach (var item in _lstBackGroundVideoFiles)
                {
                    WMPLib.IWMPMedia zMP3File = axWindowsMediaPlayer1.newMedia(item);
                    PlayList.appendItem(zMP3File);
                }
                axWindowsMediaPlayer1.currentPlaylist = PlayList;
                axWindowsMediaPlayer1.settings.setMode("loop", true);
                axWindowsMediaPlayer1.settings.volume = 10;
                //axWindowsMediaPlayer1.uiMode = "none";

                timer1.Start();
                timer1.Interval = TimerIntervale;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
        private void dgvAlbum_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            WMPLib.IWMPPlaylist playlist = axWindowsMediaPlayer1.playlistCollection.newPlaylist("myplaylist");
            WMPLib.IWMPMedia    musica;

            foreach (Musicas musicas in SalvaInfo.album.ElementAt(e.RowIndex).Faixas)
            {
                lsbFaixas.Items.Add(musicas.Titulo);

                musica = axWindowsMediaPlayer1.newMedia(musicas.LocalMusica);
                playlist.appendItem(musica);

                lsbFaixas.SelectedIndex = 0;
            }

            //adiciona a playlist ao mediaPlaqyer
            axWindowsMediaPlayer1.currentPlaylist = playlist;

            //adiciona a capa do album na pictureBox
            picCapa.ImageLocation = SalvaInfo.album.ElementAt(e.RowIndex).Capa;
            picCapa.SizeMode      = PictureBoxSizeMode.StretchImage;

            //mostra o nome do album na label
            lblNomeAlbum.Text = SalvaInfo.album.ElementAt(e.RowIndex).NomeAlbum;
        }
Example #3
0
        public frmMain()
        {
            InitializeComponent();

            this.txt_trace.Visible = false;

            this.Text = Properties.Resources.title;

            this.wmp.settings.setMode("loop", false);
            this.wmp.settings.autoStart = false;
            WMPLib.IWMPPlaylistArray plItems;
            plItems = this.wmp.playlistCollection.getByName(Properties.Resources.title);
            if (plItems.count == 0)
            {
                pl = this.wmp.playlistCollection.newPlaylist(Properties.Resources.title);
            }
            else
            {
                pl = plItems.Item(0);
                this.wmp.currentPlaylist = pl;
            }
            this.wmp.settings.autoStart = true;
            this.wmp_PlaylistCollectionChange(this, null);

            this.wmp.PlaylistCollectionChange += new EventHandler(wmp_PlaylistCollectionChange);
            this.wmp.CurrentItemChange        += new AxWMPLib._WMPOCXEvents_CurrentItemChangeEventHandler(wmp_CurrentItemChange);
            this.wmp.PlayStateChange          += new AxWMPLib._WMPOCXEvents_PlayStateChangeEventHandler(wmp_PlayStateChange);

            Control c = this.wmp as Control;

            c.DragDrop  += new DragEventHandler(Wmp_DragDrop);
            c.DragEnter += new DragEventHandler(Wmp_DragEnter);

            this.FormClosing += new FormClosingEventHandler(frmMain_FormClosing);
        }
Example #4
0
        private void PlayMedia(string pointUrl = null)
        {
            this.PlayBtn.Text = "停止";


            WMPLib.IWMPPlaylist playlist = _player.playlistCollection.newPlaylist("myplaylist");

            _player.PlayStateChange +=
                new WMPLib._WMPOCXEvents_PlayStateChangeEventHandler(Player_PlayStateChange);
            _player.MediaError +=
                new WMPLib._WMPOCXEvents_MediaErrorEventHandler(Player_MediaError);
            _player.CurrentItemChange += new WMPLib._WMPOCXEvents_CurrentItemChangeEventHandler(player_CurrentItemChange);

            playlist.clear();

            if (string.IsNullOrWhiteSpace(pointUrl) == false)
            {
                media = _player.newMedia(pointUrl);
                playlist.appendItem(media);
            }

            var array = Shuffle <string>(_listUrl.ToArray());

            foreach (string urlStr in array)
            {
                media = _player.newMedia(urlStr);
                playlist.appendItem(media);
            }
            _player.currentPlaylist = playlist;

            _timer.Start();
            _player.controls.play();
        }
 public MusicForm()
 {
     InitializeComponent();
     WMPLib.IWMPPlaylist playlist = axWindowsMediaPlayer1.playlistCollection.newPlaylist("myplaylist");
     WMPLib.IWMPMedia    media;
     media = axWindowsMediaPlayer1.newMedia(@"https://vpprojectcasino.000webhostapp.com/music/Galoski_remix.mp3");
     playlist.appendItem(media);
     axWindowsMediaPlayer1.currentPlaylist = playlist;
     controls = (WMPLib.IWMPControls3)axWindowsMediaPlayer1.Ctlcontrols;
 }
Example #6
0
        // Za ubacivanje preko pesama
        private void IzaberiPesme_Click_1(object sender, EventArgs e)
        {
            WMPLib.IWMPPlaylist playlist = player2.playlistCollection.newPlaylist("myplaylist");
            WMPLib.IWMPMedia    media;
            OpenFileDialog      fDialog = new OpenFileDialog();

            //Samo da moze da se ubacuje mp3 i ostali muzicki failovi
            fDialog.Filter = ".mp3|*.mp3";


            //Da moze vise od jedne pesme da se ubaci od jednom
            fDialog.Multiselect = true;

            //Ubacivanje u kreiranu playListu
            if (fDialog.ShowDialog() == DialogResult.OK)
            {
                files = fDialog.SafeFileNames;
                paths = fDialog.FileNames;
                foreach (string file in fDialog.FileNames)
                {
                    media = player2.newMedia(file);
                    playlist.appendItem(media);
                    br++;
                }
            }
            player2.currentPlaylist = playlist;
            index           = indeksTrenutnrPesme(player2);
            labelPesma.Text = files[index];



            // Za uklanjanje ako se ponovo ubacuju pesme
            if (listBoxSongs.Items.Count > 0)
            {
                for (int i = listBoxSongs.Items.Count - 1; i > -1; i--)
                {
                    listBoxSongs.Items.RemoveAt(i);
                }
            }

            //Za display u listBoxSong
            for (int i = 0; i < playlist.count; i++)
            {
                string strItemName = playlist.get_Item(i).name;
                listBoxSongs.Items.Add(strItemName);
            }



            //Za brisanje pesama da bude vidljivo
            deletSong.Visible   = true;
            deleteSongs.Visible = true;
        }
Example #7
0
        private void playPlaylist()
        {
            WMPLib.IWMPPlaylist playlist = _mediaPlayer.playlistCollection.newPlaylist("playlist");
            WMPLib.IWMPMedia    media;

            for (int i = 0; i < _list.Items.Count; i++)
            {
                media = _mediaPlayer.newMedia(_list.Items[i].SubItems[1].Text);
                playlist.appendItem(media);

                _mediaPlayer.currentPlaylist = playlist;
            }
        }
Example #8
0
 //Za brisanje pesama kad se icona kante stisne
 private void bunifuImageButton1_Click(object sender, EventArgs e)
 {
     listBoxSongs.Items.Clear();
     WMPLib.IWMPPlaylist playlist = player2.playlistCollection.newPlaylist("Delet");
     player2.currentPlaylist = playlist;
     labelTime.Text          = "";
     labelPesma.Text         = "";
     timeToSongsEnd.Text     = "";
     timer1.Stop();
     songTime.Value      = 0;
     songVolumen.Value   = 0;
     deletSong.Visible   = false;
     deleteSongs.Visible = false;
 }
Example #9
0
        private void Player_Load(object sender, EventArgs e)
        {
            WMPLib.IWMPPlaylist playlist = wmp.playlistCollection.newPlaylist("myplaylist");
            WMPLib.IWMPMedia    media;

            foreach (string file in files)
            {
                media = wmp.newMedia("Audio Files\\" + file);
                playlist.appendItem(media);
            }

            wmp.currentPlaylist = playlist;
            wmp.Ctlcontrols.stop();
        }
        //dodanie nazw piosenek do gramatyki systemu rozpoznawania, zczytujac nazwy piosenek z pliku, ktory najpierw zostaje stworzony
        private void addSongNamesTotheDictionary(Choices choices_, string LINK)
        {
            Process getSongNamesProcess = new Process();
            Process clearFile           = new Process();

            try
            {
                clearFile.StartInfo.FileName  = "cmd.exe";
                clearFile.StartInfo.Arguments = "/c TYPE nul > " + filePath;
                clearFile.Start();

                getSongNamesProcess.StartInfo.FileName  = "cmd.exe";
                getSongNamesProcess.StartInfo.Arguments = "/c dir /b " + LINK + " >> songNames.txt";
                getSongNamesProcess.Start();
            }
            catch
            {
                MessageBox.Show("The file couldn't have been created");
            }

            WMPLib.IWMPControls3 controls = (WMPLib.IWMPControls3)wmplayer.Ctlcontrols;
            controls.play();

            WMPLib.IWMPPlaylist playlist = wmplayer.playlistCollection.newPlaylist("myplaylist");

            try
            {
                using (StreamReader sr = File.OpenText(filePath))
                {
                    string line = null;
                    while ((line = sr.ReadLine()) != null)
                    {
                        media = wmplayer.newMedia(LINK + @"\" + line);
                        line  = line.Substring(0, line.Length - 4);
                        listBox1.Items.Add(line);
                        playlist.appendItem(media);
                        choices_.Add("Katherine play " + line);
                    }
                    wmplayer.currentPlaylist = playlist;
                    wmplayer.Ctlcontrols.stop();
                }
            }
            catch
            {
                MessageBox.Show("STREAMREADER FAILED ;___;");
            }
        }
Example #11
0
        private void GetPlayList_Click(object sender, EventArgs e)
        {
            LoadSheet loadSheet = new LoadSheet(GetPlayListsCopy());

            loadSheet.ShowDialog();
            if (loadSheet.newplayLists != null)
            {
                foreach (var list in loadSheet.newplayLists)
                {
                    playlists[list.Key] = list.Value;
                }
            }

            if (loadSheet.isValid)
            {
                List <string> requestedSongs        = loadSheet.requestedPlayList;
                string        requestedPlaylistName = loadSheet.requestedPlaylistName;
                playListLabel.Text = $"Loaded Playlist : {requestedPlaylistName}";
                listView1.Items.Clear();

                foreach (string name in requestedSongs)
                {
                    listView1.Items.Add(name.Split('\\')[name.Split('\\').Length - 1]);
                }


                currentListName = requestedPlaylistName;
                currentList     = requestedSongs;

                WMPLib.IWMPPlaylist playlist = mainMediaPlayer.playlistCollection.newPlaylist(currentListName);
                WMPLib.IWMPMedia    media;
                foreach (string file in currentList)
                {
                    media = mainMediaPlayer.newMedia(file);
                    playlist.appendItem(media);
                }
                mainMediaPlayer.currentPlaylist = playlist;
                mainMediaPlayer.Ctlcontrols.play();
                CurrentSongLabel.Text = $"Current Song : {mainMediaPlayer.currentMedia.name}";
            }
        }
Example #12
0
        static void Main()
        {
            ConsoleProperties();
            DrawBorder();
            AuthorDetails();
            ControlsDescription();

            // Music playing
            WMPLib.WindowsMediaPlayer wplayer = new WMPLib.WindowsMediaPlayer();
            string musicPath = System.Environment.CurrentDirectory;

            System.IO.DirectoryInfo dir      = new System.IO.DirectoryInfo(@"Music");
            System.IO.FileInfo[]    files    = dir.GetFiles();
            WMPLib.IWMPPlaylist     playlist = wplayer.playlistCollection.newPlaylist("myplaylist");
            foreach (System.IO.FileInfo file in files)
            {
                WMPLib.IWMPMedia media;
                media = wplayer.newMedia(file.FullName);
                playlist.appendItem(media);
            }
            wplayer.currentPlaylist = playlist;
            wplayer.settings.setMode("shuffle", true);
            wplayer.controls.play();

            timer.Start();
            dropTimer.Start();
            long time = timer.ElapsedMilliseconds;

            Console.SetCursorPosition(26, 0);
            Console.WriteLine("Level - " + level);
            Console.SetCursorPosition(26, 1);
            Console.WriteLine("Score - " + score);
            Console.SetCursorPosition(26, 2);
            Console.WriteLine("Lines cleared - " + linesCleared);
            nexttet = new Gameplay();
            tet     = nexttet;
            tet.Spawn();
            nexttet = new Gameplay();
            Update();
            GameOver();
        }
Example #13
0
        private void PlayMedia(FileInfo file)
        {
            WMPLib.IWMPMedia m = null;
            pl = this.wmp.currentPlaylist;
            for (int i = 0; i < pl.count; i++)
            {
                if (pl.Item[i].sourceURL.Equals(file.FullName, StringComparison.OrdinalIgnoreCase))
                {
                    m = pl.Item[i];
                    break;
                }
            }

            if (m == null)
            {
                m = this.wmp.newMedia(file.FullName);
                pl.appendItem(m);
            }
            ;


            this.wmp.Ctlcontrols.playItem(m);
        }
Example #14
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);
        }
Example #15
0
        private void InitInfoRow()
        {
            bg = new Bitmap(ConfigObj.BackgroundImagePath);// Image.FromFile(ConfigObj.BackgroundImagePath);
            nearBus.Location = new Point(ConfigObj.NearBus.XOffset, ConfigObj.NearBus.YOffset);
            nearBus.Size     = new Size(ConfigObj.NearBus.Width, ConfigObj.NearBus.Height);

            nearBus.MarqueeSpeed          = 999;
            nearBus.BackColor             = ConfigObj.NearBus.BGColor;
            nearBus.BackgroundImageLayout = ImageLayout.None;
            {
                TextElement element = new TextElement("Element text");
                element.IsLink    = false;
                element.ForeColor = ConfigObj.NearBus.FGColor;
                element.Text      = " ";
                element.Tag       = "Tag for element";
                element.Font      = new System.Drawing.Font(ConfigObj.NearBus.FontName /*"나눔고딕 ExtraBold"*/, ConfigObj.NearBus.FontSize /*40F*/, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Pixel, ((byte)(0)));

                nearBus.Elements.Add(element);
                nearBus.Visible = true;
            }
            this.Controls.Add(nearBus);


            if (nMarquees == null)
            {
                int rowCount  = ConfigObj.Rows.Count;
                int cellCount = 0;
                if (rowCount > 0)
                {
                    cellCount = ConfigObj.Rows[0].Cells.Count;
                }
                nMarquees = new SuperMarquee[rowCount * cellCount];

                int cellNum = 0;
                foreach (InfoRow row in ConfigObj.Rows)
                {
                    foreach (InfoCell cell in row.Cells)
                    {
                        nMarquees[cellNum]          = new SuperMarquee();
                        nMarquees[cellNum].Location = new Point(cell.XOffset + row.XOffset, cell.YOffset + row.YOffset);
                        nMarquees[cellNum].Size     = new Size(cell.Width, cell.Height);

                        nMarquees[cellNum].MarqueeSpeed          = 999;
                        nMarquees[cellNum].BackColor             = cell.BGColor;
                        nMarquees[cellNum].BackgroundImageLayout = ImageLayout.None;
                        if (cellNum % 6 == 0)
                        {
                            if ((cellNum / 6) % 2 == 0)
                            {
                                nMarquees[cellNum].BackgroundImage = new Bitmap(ConfigBIT.BasePath + @"\Image\Vertical\저상버스.png");
                            }
                            else
                            {
                                nMarquees[cellNum].BackgroundImage = new Bitmap(ConfigBIT.BasePath + @"\Image\Vertical\좌석버스.png");
                            }
                        }
                        else if (cellNum % 6 == 3)
                        {
                            nMarquees[cellNum].BackgroundImage = new Bitmap(ConfigBIT.BasePath + @"\Image\Vertical\ArriveTimeBack.png");
                        }
                        else if (cellNum % 6 == 4)
                        {
                            nMarquees[cellNum].BackgroundImage = pictoImages[(cellNum / 6)];//new Bitmap(@"..\..\Image\Vertical\버스방향.png");

                            nMarquees[cellNum].BackgroundImageLayout = ImageLayout.Tile;
                        }
                        else if (cellNum % 6 == 5)
                        {
                            if ((cellNum / 6) % 2 == 0)
                            {
                                nMarquees[cellNum].BackgroundImage = new Bitmap(ConfigBIT.BasePath + @"\Image\Vertical\첫차.png");
                            }
                            else
                            {
                                nMarquees[cellNum].BackgroundImage = new Bitmap(ConfigBIT.BasePath + @"\Image\Vertical\막차.png");
                            }
                        }

                        nMarquees[cellNum].Elements.Clear();

                        if (nMarquees[cellNum].BackgroundImage == null)
                        {
                            TextElement element = new TextElement("Element text");
                            element.IsLink      = false;
                            element.ForeColor   = cell.FGColor;
                            element.Text        = "2412";
                            element.Tag         = "Tag for element";
                            element.Font        = new System.Drawing.Font(cell.FontName /*"나눔고딕 ExtraBold"*/, cell.FontSize /*40F*/, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Pixel, ((byte)(0)));
                            element.ToolTipText = "Tool tip for element";

                            if (cellNum % 6 == 2)
                            {
                                element.StringFormat.Alignment = StringAlignment.Far;
                            }

                            nMarquees[cellNum].Elements.Add(element);
                            nMarquees[cellNum].Elements.Add(element);
                            nMarquees[cellNum].Visible = true;
                            nMarquees[cellNum].Show();
                        }
                        else
                        {
                            TextElement element = new TextElement("Element text");
                            element.IsLink      = false;
                            element.ForeColor   = cell.FGColor;
                            element.Text        = " ";
                            element.Tag         = "Tag for element";
                            element.Font        = new System.Drawing.Font(cell.FontName /*"나눔고딕 ExtraBold"*/, cell.FontSize /*40F*/, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Pixel, ((byte)(0)));
                            element.ToolTipText = "Tool tip for element";

                            if (cellNum % 6 == 2)
                            {
                                element.StringFormat.Alignment = StringAlignment.Far;
                            }

                            nMarquees[cellNum].Elements.Add(element);
                            nMarquees[cellNum].Visible = true;
                            nMarquees[cellNum].Show();
                        }

                        cellNum++;
                    }
                }
                this.Controls.AddRange(nMarquees);

                for (int rowid = 0; rowid < ConfigObj.Rows.Count; rowid++)
                {
                    for (int icell = 0; icell < ConfigObj.Rows[0].Cells.Count; icell++)
                    {
                        nMarquees[rowid * 6].Invoke((MethodInvoker) delegate
                        {
                            if (nMarquees[rowid * 6 + icell].Elements.Count > 1)
                            {
                                nMarquees[rowid * 6 + icell].Elements.RemoveAt(1);
                            }
                            nMarquees[rowid * 6 + icell].Elements[0].Text = string.Empty;
                            nMarquees[rowid * 6 + icell].BackgroundImage  = null;
                        });
                    }
                }



                axWindowsMediaPlayer.Location = new Point(0, 767);
                axWindowsMediaPlayer.Size     = new Size(768, 1289 - 767);
                // TODO 파일 명 바꾸기
                string scfile = ConfigBIT.BasePath + @"/DB/SNRDB/20151016";
                using (BinaryReader brBinaryReader = new BinaryReader(File.Open(scfile, FileMode.Open)))
                {
                    FileInfo f  = new FileInfo(scfile);
                    long     s1 = f.Length;
                    if ((s1 - 5) % 35 == 0)
                    {
                        Scenario_DataPlain fileData = new Scenario_DataPlain();
                        fileData.SetDataFrom(brBinaryReader);

                        foreach (var item in fileData.formData)
                        {
                            MediaFileInfo mInfo = new MediaFileInfo();
                            mInfo.fileName   = ConfigBIT.BasePath + @"/DB/SNR/" + item.fileName;
                            mInfo.durSeconds = item.durationSecond;
                            mInfo.fileType   = item.dataType;
                            mediaList.Add(mInfo);
                        }
                        if (mediaList.Count > 0)
                        {
                            WMPLib.IWMPPlaylist playlist = axWindowsMediaPlayer.playlistCollection.newPlaylist("myplaylist");
                            WMPLib.IWMPMedia    media;
                            foreach (var file in mediaList)
                            {
                                media = axWindowsMediaPlayer.newMedia(file.fileName);
                                playlist.appendItem(media);
                            }
                            axWindowsMediaPlayer.settings.setMode("loop", true);
                            axWindowsMediaPlayer.currentPlaylist = playlist;
                            axWindowsMediaPlayer.Ctlcontrols.play();
                            axWindowsMediaPlayer.settings.mute = true;
                            axWindowsMediaPlayer.stretchToFit  = true;

                            /*
                             * dropCnt = mediaList[0].durSeconds;
                             * curMedia = mediaList[0].fileName;
                             * axWindowsMediaPlayer.Visible = true;
                             * axWindowsMediaPlayer.URL = curMedia;
                             *
                             * axWindowsMediaPlayer.Ctlcontrols.play();
                             */
                        }
                    }
                    else
                    {
                        Scenario_DataSchedule fileData = new Scenario_DataSchedule();
                        fileData.SetDataFrom(brBinaryReader);
                    }
                }
            }
        }
Example #16
0
        //chuc nag keo tha
        private void ds_DragDrop(object sender, DragEventArgs e)
        {
            try
            {
                ds.Items.Clear();
                //tao playlist chua cac bai hat duoc chon
                plItems = axWindowsMediaPlayer1.playlistCollection.getByName(myPlaylist);
                pl = axWindowsMediaPlayer1.playlistCollection.newPlaylist(myPlaylist);

                //them vao listview va thu vien WMP

                string[] s = (string[])e.Data.GetData(DataFormats.FileDrop, false);
                FileInfo f;
                for (int i = 0; i < s.Length; i++)
                {
                    f = new FileInfo(s[i]);
                    ds.Items.Add(f.Name);
                    ListViewItem item = new ListViewItem(s[i]);
                    lb2.Items.Add(f.FullName);

                    m1 = axWindowsMediaPlayer1.newMedia(s[i]);
                    pl.appendItem(m1);
                }
                play.Hide();
                pause.Show();
                axWindowsMediaPlayer1.currentPlaylist = pl;
                axWindowsMediaPlayer1.Ctlcontrols.play();
                axWindowsMediaPlayer1.playlistCollection.remove(pl);
            }
            catch (Exception)
            {
                //MessageBox.Show("Không Cho Phép Kéo Thả");
            }
        }
Example #17
0
 private void SongPlayer_Load(object sender, EventArgs e)
 {
     playlist = wplayer.playlistCollection.newPlaylist("myplaylist");
 }
Example #18
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);
        }
Example #19
0
        private void shuffleoff_Click(object sender, EventArgs e)
        {
            if (ds.Items.Count > 0)
            {
                axWindowsMediaPlayer1.playlistCollection.remove(pl);
            }

            pl = axWindowsMediaPlayer1.playlistCollection.newPlaylist(myPlaylist);
            ListViewItem lvi;
            for (int i = 0; i < ds.Items.Count; i++)
            {
                vt = rd.Next(0, ds.Items.Count - 1);
                lvi = new ListViewItem(Path.GetFileNameWithoutExtension(lb2.Items[vt].ToString()));
                ds.Items[i] = lvi;
                m1 = axWindowsMediaPlayer1.newMedia(lb2.Items[vt].ToString());
                pl.appendItem(m1);
            }
            axWindowsMediaPlayer1.currentPlaylist = pl;
            shuffle.Show();
            shuffleoff.Hide();
        }