Esempio n. 1
0
        private void btnShuf_Click(object sender, EventArgs e)
        {
            ListView.ListViewItemCollection list = listView1.Items;
            Random r = new Random();
            int    n = list.Count;

            while (n > 1)
            {
                n--;
                int          k  = r.Next(n + 1);
                ListViewItem v1 = (ListViewItem)list[k];
                ListViewItem v2 = (ListViewItem)list[n];
                list[k] = new ListViewItem();
                list[n] = new ListViewItem();
                list[k] = v2;
                list[n] = v1;
            }
            WMPLib.IWMPPlaylist playlist = mplayer.playlistCollection.newPlaylist("My Playlist");
            WMPLib.IWMPMedia    media;
            for (int i = 0; i < listView1.Items.Count; i++)
            {
                int j = 1;
                media = mplayer.newMedia(listView1.Items[i].SubItems[j].Text);
                playlist.appendItem(media);
                j++;

                mplayer.currentPlaylist = playlist;
                mplayer.Ctlcontrols.play();
                tmrLabel.Start();
                tmrProg.Start();
            }
        }
        private void playAll()
        {
            WMPLib.IWMPPlaylist playList = axWindowsMediaPlayer1.playlistCollection.newPlaylist("myPlayList");
            WMPLib.IWMPMedia    media;


            try
            {
                for (int i = 0; i < listView1.Items.Count; i++)
                {
                    int ii = 1;

                    // creat media instance from the current file location
                    media = axWindowsMediaPlayer1.newMedia(listView1.Items[i].SubItems[ii].Text);

                    // add the media to playlist
                    playList.appendItem(media);

                    axWindowsMediaPlayer1.currentPlaylist = playList;
                    axWindowsMediaPlayer1.Ctlcontrols.play();
                    axWindowsMediaPlayer1.PlayStateChange += (s, e) =>
                    {
                        if (axWindowsMediaPlayer1.playState == WMPLib.WMPPlayState.wmppsPlaying)
                        {
                            this.mediaStatus.Text = axWindowsMediaPlayer1.currentMedia.name + " is Playing ...";
                        }
                    };
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Can't Play the Media", "Error");
            }
        }
Esempio n. 3
0
        public void PlayListOlustur(string[] list)
        {
            waveList = WaveKontrol(list);
            int plCount = playlist.count;

            //playlist daha önce oluşturuldu ise
            if (plCount > 0)
            {
                foreach (WaveSplit file in waveList)
                {
                    media = axWindowsMediaPlayer1.newMedia(file.newFilePath);
                    axWindowsMediaPlayer1.currentPlaylist.insertItem(playlist.count, media);
                    string[] parca = { file.muzikAdi, file.muzikSanatci, media.durationString };

                    listView1.Items.Add(new ListViewItem(parca));
                }
            }
            //yeni playlist
            else
            {
                foreach (WaveSplit file in waveList)
                {
                    media = axWindowsMediaPlayer1.newMedia(file.newFilePath);
                    playlist.appendItem(media);
                    string[] parca = { file.muzikAdi, file.muzikSanatci, media.durationString };
                    listView1.Items.Add(new ListViewItem(parca));
                }
                axWindowsMediaPlayer1.currentPlaylist = playlist;
            }
        }
Esempio n. 4
0
        public MainForm(String[] file)
        {
            InitializeComponent();
            playlist = MediaPlayerControl.playlistCollection.newPlaylist("MyPlayList");
            MediaPlayerControl.currentPlaylist = playlist;

            NPlist = null;

            MyPlaylists    = playlists.getInstance();
            MyPlaylistData = PlaylistData.getInstance();
            if (MyPlaylists.getPlaylistNames() != null)
            {
                foreach (String filename in MyPlaylists.getPlaylistNames())
                {
                    PLlistBox.Items.Add(filename);
                }
            }
            if (file.Length > 0)
            {
                NPlist = file;
                foreach (String listItem in file)
                {
                    string value = listItem.Substring(listItem.LastIndexOf("\\") + 1);
                    value = "    " + value;
                    NPlistbox.Items.Add(value);
                    media = MediaPlayerControl.newMedia(listItem);
                    playlist.appendItem(media);
                }
                MediaPlayerControl.Ctlcontrols.play();
                NPlistbox.SelectedIndex = 0;
            }
        }
Esempio n. 5
0
        public FormDiffusion()
        {
            InitializeComponent();
            initialyzeKinect();
            //initialisation des composants du media player
            WMPLib.IWMPPlaylist playlist = mediaPlayer.newPlaylist("myPlaylist", string.Empty);
            string[]            lines    = System.IO.File.ReadAllLines(@"playlist.txt");

            foreach (string path in lines)
            {
                WMPLib.IWMPMedia temp = mediaPlayer.newMedia(path);
                playlist.appendItem(temp);
            }

            mediaPlayer.currentPlaylist      = playlist;
            mediaPlayer.settings.autoStart   = true;
            _gestureRight.GestureRecognized += GestureRight_GestureRecognized;
            _gestureLeft.GestureRecognized  += GestureLeft_GestureRecognized;
            lecteur = new SoundPlayer(@"C:\Users\Kazadri\Source\Repos\REDX\ClientDiffusion\bin\Release\musique.wav");

            this.FormBorderStyle = FormBorderStyle.FixedSingle;
            this.Height          = 1032;
            this.Width           = 1632;
            lecteur.Play();
            musicIsPlaying = true;
        }
Esempio n. 6
0
        private void StartVideo_Click(object sender, EventArgs e)
        {
            if (JeZakliknuetVideo())
            {
                if (z == null)
                {
                    z = new Zobrazovac();
                }
                AxWMPLib.AxWindowsMediaPlayer prehravac = z.WMP();
                WMPLib.IWMPPlaylist           playlist  = prehravac.playlistCollection.newPlaylist("myplaylist");
                WMPLib.IWMPMedia media;
                for (int i = 0; i < pocetVidei; i++)
                {
                    if (cLBZoznamReklam.GetItemCheckState(i) == CheckState.Checked)
                    {
                        string s = "..\\..\\Reklamy\\" + cLBZoznamReklam.Items[i].ToString();
                        //media = prehravac.newMedia(s);
                        media = prehravac.newMedia(cLBZoznamReklam.Items[i].ToString());
                        playlist.appendItem(media);
                    }
                }

                z.Show();
                prehravac.currentPlaylist = playlist;
                prehravac.Ctlcontrols.play();
                pauseVideo.Text        = "Pause";
                prehravac.stretchToFit = true;
            }
            else
            {
                MessageBox.Show("Nevybral si žiadne video");
            }
        }
Esempio n. 7
0
        private void removeButton_Click(object sender, EventArgs e)
        {
            //Delete the selected row in the dataGridView.
            try
            {
                dataGridView1.Rows.RemoveAt(dataGridView1.SelectedRows[0].Index);

                //Update the current playlist by reading all the files on the dataGridView.
                allFilenames = getSongsInPlaylist("Name"); //get all the name files shown on the dataGridView.
                allPaths     = getSongsInPlaylist("Path"); //get all the paths of the songs shown on the dataGridView.


                //Create a Media playlist with all the items in the listBox.
                List <string> listPaths = dataGridView1.Rows.OfType <DataGridViewRow>().Where(x => x.Cells[1].Value != null).Select(x => x.Cells[1].Value.ToString()).ToList(); //get all the paths of the dataGridView.
                foreach (var item in listPaths)
                {
                    listBox5.Items.Add(item); //Add all the paths of the dataGridView in a listBox.
                }

                ListBox.ObjectCollection list = listBox5.Items;

                WMPLib.IWMPPlaylist playlist = axWindowsMediaPlayer1.playlistCollection.newPlaylist("myplaylist");
                WMPLib.IWMPMedia    media;
                foreach (object item in listPaths)
                {
                    media = axWindowsMediaPlayer1.newMedia((string)item);
                    playlist.appendItem(media);
                }
                axWindowsMediaPlayer1.currentPlaylist = playlist;
                axWindowsMediaPlayer1.Ctlcontrols.play(); //Start playing the songs in the playlist
            }
            catch (Exception) { }
        }
Esempio n. 8
0
        private void dataGridView1_CellDoubleClick_1(object sender, DataGridViewCellEventArgs e)
        {
            frm.Hide();
            frm.label1.Text = " ";

            frm.label1.Text = dataGridView1.CurrentRow.Cells["nombre"].Value.ToString();
            frm.axWindowsMediaPlayer1.URL = dataGridView1.CurrentRow.Cells["direccion"].Value.ToString();

            WMPLib.IWMPPlaylist playlist = frm.axWindowsMediaPlayer1.playlistCollection.newPlaylist("myplaylist");
            WMPLib.IWMPMedia    media;

            media = frm.axWindowsMediaPlayer1.newMedia(dataGridView1.CurrentRow.Cells["direccion"].Value.ToString());
            playlist.appendItem(media);

            frm.axWindowsMediaPlayer1.currentPlaylist = playlist;
            listamp3.RemoveRange(0, listamp3.Count);
            string dat = dataGridView1.CurrentRow.Cells["direccion"].Value.ToString();

            cargarima(dat);
            tagcan(dat);
            frm.dataGridView1.DataSource = null;
            frm.dataGridView1.Refresh();
            frm.dataGridView1.DataSource = listamp3;
            frm.dataGridView1.Refresh();
            frm.Show();
        }
Esempio n. 9
0
        private void ReMusicPlayer_EnabledChanged(object sender, EventArgs e)
        {
            if (Enabled)
            {
                WMPLib.IWMPPlaylist _List = axWindowsMediaPlayer1.playlistCollection.newPlaylist("CurrentList");

                foreach (var f in Directory.GetFiles(_PlayerDirectory, "*.mp3"))
                {
                    var _media = axWindowsMediaPlayer1.newMedia(f);
                    if (_media == null)
                    {
                        break;
                    }
                    _List.appendItem(_media);
                }
                if (_List == null)
                {
                    return;
                }
                axWindowsMediaPlayer1.currentPlaylist = _List;
                //play
                axWindowsMediaPlayer1.Ctlenabled = true;
                axWindowsMediaPlayer1.Ctlcontrols.play();
            }
            else
            {
                axWindowsMediaPlayer1.Ctlcontrols.pause();
            }
        }
Esempio n. 10
0
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog open = new OpenFileDialog();

            open.Multiselect = true;
            open.Filter      = "MP3|*.mp3";
            lst_nhac.Items.Clear();

            if (open.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                // axWindowsMediaPlayer1.URL = open.FileName;
                WMPLib.IWMPPlaylist playlist = axWindowsMediaPlayer1.newPlaylist("my playlist", string.Empty);

                foreach (string file in open.FileNames)
                {
                    WMPLib.IWMPMedia Mmedia = axWindowsMediaPlayer1.newMedia(file);
                    playlist.appendItem(Mmedia);
                    lst_nhac.Items.Add(file);
                }
                axWindowsMediaPlayer1.currentPlaylist = playlist;
                axWindowsMediaPlayer1.Ctlcontrols.play();
                axWindowsMediaPlayer1.settings.autoStart = true;
                axWindowsMediaPlayer1.settings.setMode("loop", true);
            }
        }
Esempio n. 11
0
        public void UpdateDataGrid()
        {
            //List<string> songs = new List<string>();
            //foreach(DataGridViewRow dataRow in this.Playlist_datagrid.Rows)
            //{
            //    songs.Add(dataRow.Cells[1].Value.ToString());
            //}

            //songs = songs.Distinct().ToList();
            if (this.Playlist_datagrid.Rows.Count != 0)
            {
                Playlist_datagrid.Rows.Clear();
            }
            playlist = axWindowsPlayer.playlistCollection.newPlaylist("myplaylist");
            WMPLib.IWMPMedia media;
            int i = 1;

            foreach (string song in song_url)
            {
                int n = this.Playlist_datagrid.Rows.Add();
                this.Playlist_datagrid.Rows[n].Cells[0].Value = i++;
                this.Playlist_datagrid.Rows[n].Cells[1].Value = Path.GetFileName(song);
                media = axWindowsPlayer.newMedia(song);
                playlist.appendItem(media);
            }

            axWindowsPlayer.currentPlaylist = playlist;
        }
Esempio n. 12
0
        public void LoadMusic(string GetMusic)
        {
            try
            {
                listBox1.Items.Clear();
                Namemusic.Clear();
                urlmusic.Clear();
                var doc = new XmlDocument();
                doc.Load(new XmlTextReader(GetMusic));
                var audioTags = doc.SelectNodes("//audio");
                PlayList = axWindowsMediaPlayer1.playlistCollection.newPlaylist("vkPlayList");
                int id = 0;
                foreach (XmlNode audioTag in audioTags)
                {
                    string artist = "";
                    string title  = "";
                    string url    = "";
                    if (audioTag["artist"] != null)
                    {
                        artist = audioTag["artist"].InnerText;
                    }
                    if (audioTag["title"] != null)
                    {
                        title = audioTag["title"].InnerText;
                    }
                    if (audioTag["url"] != null)
                    {
                        url = audioTag["url"].InnerText; url = url.Split('?')[0];
                    }
                    if (url != "")
                    {
                        Media = axWindowsMediaPlayer1.newMedia(url);
                        if (Media.isReadOnlyItem("title") == false)
                        {
                            Media.setItemInfo("title", title);
                        }
                        if (Media.isReadOnlyItem("artist") == false)
                        {
                            Media.setItemInfo("artist", artist);
                        }
                        if (Media.isReadOnlyItem("Id") == false)
                        {
                            Media.setItemInfo("Id", id.ToString());
                        }
                        PlayList.appendItem(Media);
                        listBox1.Items.Add(artist + " – " + title);
                        urlmusic.Add(url);
                        Namemusic.Add(artist + " – " + title);
                        id++;
                    }
                }
                axWindowsMediaPlayer1.currentPlaylist = PlayList;
                metroLabel2.Text = "Load " + listBox1.Items.Count.ToString() + " items.";
            }

            catch { MessageBox.Show("Ошибка загрузки (LoadMusic ERROR)"); }
        }
        public void PlayListCreation(List <string> filesSelected)
        {
            for (int i = 0; i < filesSelected.Count; i++)
            {
                playlist.appendItem(wplayer.newMedia(filesSelected[i].Replace(@"\\", @"\")));
            }

            wplayer.currentPlaylist = playlist;
        }
        private void playFirstSongToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (treeViewPlaylists.SelectedNode == null)
            {
                MessageBox.Show("No playlist selected!");
            }
            else//set a playlist into playing starting from the FIRST in the list
            {
                foreach (LinkedList <string> llist in allPlaylists)
                {
                    //get selected playlist to play
                    //check if selection is child or parent
                    if (treeViewPlaylists.SelectedNode.Level == 1) //some testing for this sshows me that 0 is parent and children increment from there
                    {
                        //this is child so compare parent to DLL

                        String find = "";//empty declaration
                        try
                        {
                            find = find + llist.Find(llist.First()).Value;
                            if (treeViewPlaylists.SelectedNode.Parent.Text.CompareTo(find) == 0)
                            {
                                currentplaylist = axWindowsMediaPlayer1.playlistCollection.newPlaylist(treeViewPlaylists.SelectedNode.Parent.Text);
                                foreach (string song in llist)//everything in linked list to current playlist
                                {
                                    audiofile = axWindowsMediaPlayer1.newMedia(networkpath + "\\" + song);
                                    currentplaylist.appendItem(audiofile);
                                }

                                axWindowsMediaPlayer1.currentPlaylist = currentplaylist;
                            }
                        }
                        catch { }
                    }
                    else //is parent
                    {
                        String find = "";//empty declaration
                        try
                        {
                            find = find + llist.Find(llist.First()).Value;
                            if (treeViewPlaylists.SelectedNode.Text.CompareTo(find) == 0)
                            {
                                currentplaylist = axWindowsMediaPlayer1.playlistCollection.newPlaylist(treeViewPlaylists.SelectedNode.Text);
                                foreach (string song in llist)
                                {
                                    audiofile = axWindowsMediaPlayer1.newMedia(networkpath + "\\" + song);
                                    currentplaylist.appendItem(audiofile);
                                }

                                axWindowsMediaPlayer1.currentPlaylist = currentplaylist;
                            }
                        }
                        catch { }
                    }
                }
            }
        }
Esempio n. 15
0
        public static void sound()
        {
            while (true)
            {
                if (clients.Count > 0)
                {
                    try
                    {
                        foreach (KeyValuePair <int, int> entry in clients)
                        {
                            int    num   = entry.Key;
                            int    ra    = entry.Value;
                            string donvi = num.ToString().Substring(3, 1);
                            string chuc  = num.ToString().Substring(2, 1);
                            string tram  = num.ToString().Substring(1, 1);
                            string nghin = num.ToString().Substring(0, 1);

                            WMPLib.WindowsMediaPlayer mp = new WMPLib.WindowsMediaPlayer();
                            WMPLib.IWMPPlaylist       playlist = mp.playlistCollection.newPlaylist("customerCall");
                            WMPLib.IWMPMedia          media, media1, media2, media3, media4, media5, media6;

                            string moi = Directory.GetCurrentDirectory() + "\\Resources\\moi.mp3";
                            media = mp.newMedia(moi);

                            string sokhachnghin = Directory.GetCurrentDirectory() + "\\Resources\\" + nghin + ".mp3";
                            media1 = mp.newMedia(sokhachnghin);

                            string sokhachtram = Directory.GetCurrentDirectory() + "\\Resources\\" + tram + ".mp3";
                            media2 = mp.newMedia(sokhachtram);

                            string sokhachchuc = Directory.GetCurrentDirectory() + "\\Resources\\" + chuc + ".mp3";
                            media3 = mp.newMedia(sokhachchuc);

                            string sokhachdonvi = Directory.GetCurrentDirectory() + "\\Resources\\" + donvi + ".mp3";
                            media4 = mp.newMedia(sokhachdonvi);

                            string vaocua = Directory.GetCurrentDirectory() + "\\Resources\\cuaso.mp3";
                            media5 = mp.newMedia(vaocua);

                            string socua = Directory.GetCurrentDirectory() + "\\Resources\\" + ra + ".mp3";
                            media6 = mp.newMedia(socua);

                            playlist.appendItem(media);
                            playlist.appendItem(media1);
                            playlist.appendItem(media2);
                            playlist.appendItem(media3);
                            playlist.appendItem(media4);
                            playlist.appendItem(media5);
                            playlist.appendItem(media6);
                            mp.currentPlaylist = playlist;
                            mp.controls.play();
                            clients.Remove(num);
                            Thread.Sleep(7000);                             //sleep 10s đợi phát âm thanh gọi khách trước xong.
                        }
                    }
                    catch { }
                }
            }
        }
Esempio n. 16
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                files = openFileDialog1.SafeFileNames;
                paths = openFileDialog1.FileNames;

                for (int i = 0; i < files.Length; i++)
                {
                    listBox1.Items.Add(files[i]);
                    WMPLib.IWMPMedia mediaItem = axWindowsMediaPlayer1.newMedia(paths[i]);
                    playlist.appendItem(mediaItem);
                    media.Add(mediaItem);
                }
                Ser_Save();
                axWindowsMediaPlayer1.currentPlaylist = playlist;
                //Ser_Load();
            }
        }
Esempio n. 17
0
 public MusicForm()
 {
     InitializeComponent();
     WMPLib.IWMPPlaylist playlist = axWindowsMediaPlayer1.playlistCollection.newPlaylist("myplaylist");
     WMPLib.IWMPMedia    media;
     media = axWindowsMediaPlayer1.newMedia(@"https://vpprojectcasino.000webhostapp.com/music/pokerMusic.mp3");
     playlist.appendItem(media);
     axWindowsMediaPlayer1.currentPlaylist = playlist;
     controls = (WMPLib.IWMPControls3)axWindowsMediaPlayer1.Ctlcontrols;
 }
Esempio n. 18
0
 public void createPlaylist()
 {
     WMPLib.IWMPPlaylist playlist = axWindowsMediaPlayer1.playlistCollection.newPlaylist(Global.playlistName);
     WMPLib.IWMPMedia    media;
     for (int i = 0; i < Global.mediaFiles.Count; i++)
     {
         media = axWindowsMediaPlayer1.newMedia(findPath(Global.mediaFiles[i]));
         playlist.appendItem(media);
     }
     axWindowsMediaPlayer1.currentPlaylist = playlist;
 }
Esempio n. 19
0
        private void добавитьToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog opg = new OpenFileDialog();

            if (opg.ShowDialog() == DialogResult.OK)
            {
                var d = mp.newMedia(opg.FileName);
                p.appendItem(d);
                ChangePL?.Invoke(this);
            }
        }
Esempio n. 20
0
 private void LoadTrackList()
 {
     playlist = MediaPlayer.playlistCollection.newPlaylist("fromVK");
     foreach (var audio in audioList)
     {
         media = MediaPlayer.newMedia(audio.url);
         playlist.appendItem(media);
         TrackListBox.Items.Add(audio.artist + " - " + audio.title);
     }
     MediaPlayer.currentPlaylist = playlist;
     MediaPlayer.Ctlcontrols.stop();
 }
Esempio n. 21
0
 private void AddAndPlay(string fileName)
 {
     WMPLib.IWMPMedia mediaItem = player.newMedia(fileName);
     currentPlayList.appendItem(mediaItem);
     playlist.Items.Add(System.IO.Path.GetFileName(fileName));
     if (!(player.playState == WMPLib.WMPPlayState.wmppsPlaying))
     {
         player.Ctlcontrols.play();
     }
     Disable(btnPlay);
     Enable(btnPause, btnStop, btnFullScreen, btnFastForward, btnRewind, btnScreenShot, btnNext, btnPrevious);
     player.Ctlcontrols.playItem(player.currentPlaylist.Item[player.currentPlaylist.count - 1]);
 }
Esempio n. 22
0
        private void addButton_Click(object sender, EventArgs e)
        {
            //Select the items to add to the dataGridView.
            OpenFileDialog openFileDialog1 = new OpenFileDialog();

            openFileDialog1.Multiselect = true;
            openFileDialog1.Filter      = "Mp3 Files|*.mp3|Avi Files| *.avi | Wav Files | *.wav";

            if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                filesNames = openFileDialog1.SafeFileNames;
                paths      = openFileDialog1.FileNames;


                for (int i = 0; i < paths.Length; i++)
                {
                    //Dislay the playlist on a DataGridView. The first column holds the filenames and the second the file paths.
                    try
                    {
                        fillDataTable(filesNames[i], paths[i]);
                    }
                    catch (Exception ex)
                    {
                    }
                }
            }

            allFilenames = getSongsInPlaylist("Name"); //get all the name files shown on the dataGridView.
            allPaths     = getSongsInPlaylist("Path"); //get all the paths of the songs shown on the dataGridView.

            //Create a Media playlist with all the items in the dataGridView.
            List <string> listPaths = dataGridView1.Rows.OfType <DataGridViewRow>().Where(x => x.Cells[1].Value != null).Select(x => x.Cells[1].Value.ToString()).ToList(); //get all the paths of the dataGridView.

            foreach (var item in listPaths)
            {
                listBox5.Items.Add(item); //Add all the paths in a listBox.
            }


            ListBox.ObjectCollection list = listBox5.Items;

            WMPLib.IWMPPlaylist playlist = axWindowsMediaPlayer1.playlistCollection.newPlaylist("myplaylist");
            WMPLib.IWMPMedia    media;
            foreach (object item in listPaths)
            {
                media = axWindowsMediaPlayer1.newMedia((string)item);
                playlist.appendItem(media);
            }
            axWindowsMediaPlayer1.currentPlaylist = playlist;
            axWindowsMediaPlayer1.Ctlcontrols.play(); //Start playing the songs in the playlist
        }
Esempio n. 23
0
        private void importToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (playList.Items.Count > 0)
            {
                string[] songsArray = playList.Items.OfType <string>().ToArray();

                playlist = Player.playlistCollection.newPlaylist(namePlaylist.Text);

                foreach (string song in songsArray)
                {
                    playlist.appendItem(Player.newMedia(song));
                }
            }
        }
 private void playSongToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (listBoxSongs.SelectedItem == null)
     {
         MessageBox.Show("No Songs Selected!");
     }
     else
     {
         string song = listBoxSongs.SelectedItem.ToString();
         currentplaylist = axWindowsMediaPlayer1.playlistCollection.newPlaylist("Not in a playlist"); //only playing song
         audiofile       = axWindowsMediaPlayer1.newMedia(networkpath + "\\" + song);
         currentplaylist.appendItem(audiofile);
         axWindowsMediaPlayer1.currentPlaylist = currentplaylist;
     }
 }
Esempio n. 25
0
 private void Form2_Load(object sender, EventArgs e)
 {
     WMPLib.IWMPPlaylist playlist = axWindowsMediaPlayer1.playlistCollection.newPlaylist("myplaylist");
     WMPLib.IWMPMedia    media;
     if (FileList.Count != 0)
     {
         foreach (string file in FileList)
         {
             media = axWindowsMediaPlayer1.newMedia(file);
             playlist.appendItem(media);
         }
     }
     axWindowsMediaPlayer1.currentPlaylist = playlist;
     axWindowsMediaPlayer1.Ctlcontrols.play();
 }
Esempio n. 26
0
 private void CreateNewPlaylist()
 {
     WMPLib.IWMPPlaylist playlist = axWindowsMediaPlayer1.playlistCollection.newPlaylist("NU_Playlist");
     WMPLib.IWMPMedia    media;
     if (open.ShowDialog() == DialogResult.OK)
     {
         FileName = open.FileNames;
         foreach (string file in FileName)
         {
             media = axWindowsMediaPlayer1.newMedia(file);
             playlist.appendItem(media);
         }
         axWindowsMediaPlayer1.currentPlaylist = playlist;
     }
 }
Esempio n. 27
0
        private void Update_PlayList(string s)
        {
            playList = mediaPlayer.playlistCollection.newPlaylist(s);

            for (int i = 0; i < audioListCurrent.Count; ++i)
            {
                media = mediaPlayer.newMedia(audioListCurrent[i].url);
                playList.appendItem(media);

                songsList.Items.Add(audioListCurrent[i].artist + " - " + audioListCurrent[i].title);
            }
            mediaPlayer.currentPlaylist = playList;
            mediaPlayer.Ctlcontrols.stop();
            mediaPlayer.playlistCollection.remove(playList);
        }
 private void button2_Click(object sender, EventArgs e)                                                     //Play all button
 {
     if (listView1 != null)                                                                                 //there must be at least 1 song
     {
         WMPLib.IWMPPlaylist playlist = axWindowsMediaPlayer1.playlistCollection.newPlaylist("myplaylist"); //i create a playlist item
         WMPLib.IWMPMedia    media;                                                                         //and a media item
         for (int i = 0; i < listView1.Items.Count; i++)                                                    //for all the songs
         {
             media = axWindowsMediaPlayer1.newMedia(listView1.Items[i].SubItems[1].Text);                   //we get the 2nd subitem of each row which is the full path
             playlist.appendItem(media);                                                                    //we create the playlist by adding all the paths
         }
         axWindowsMediaPlayer1.currentPlaylist = playlist;                                                  //we initialize the playlist with the one we just created
         axWindowsMediaPlayer1.Ctlcontrols.play();                                                          //we play the playlist
     }
 }
Esempio n. 29
0
        // 创建播放列表

        private void createPlayList(int begin)
        {
            // 把文件们放到新建的播放列表中

            WMPLib.IWMPPlaylist playlist = axWindowsMediaPlayer1.playlistCollection.newPlaylist("HeabPlayList");
            WMPLib.IWMPMedia    media;

            for (int i = begin; i < lbSongsList.Items.Count; i++)
            {
                media = axWindowsMediaPlayer1.newMedia(lbSongsList.Items[i].SubItems[1].Text);
                playlist.appendItem(media);

                axWindowsMediaPlayer1.currentPlaylist = playlist;
                //axWindowsMediaPlayer1.Ctlcontrols.play();
            }
        }
Esempio n. 30
0
        // button odpowiedzialny za odtwarzanie playlisty
        private void button1_Click(object sender, EventArgs e)
        {
            WMPLib.IWMPPlaylist Playlist = axWindowsMediaPlayer1.playlistCollection.newPlaylist("myplaylist");
            WMPLib.IWMPMedia    media;
            // dodanie wszystkich wybranych piosenek i utworzenie playlisty
            for (int i = 0; i < listView1.Items.Count; i++)
            {
                int ii = 1;
                media = axWindowsMediaPlayer1.newMedia(listView1.Items[i].SubItems[ii].Text);
                Playlist.appendItem(media);
                ii++;

                axWindowsMediaPlayer1.currentPlaylist = Playlist;
                axWindowsMediaPlayer1.Ctlcontrols.play();
            }
        }
Esempio n. 31
0
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            while (!App.Default.auth)
            {
                Thread.Sleep(500);
            }
            
            WebRequest req = WebRequest.Create("https://api.vk.com/method/audio.get?owner_id=" + App.Default.id + "&need_user=0&access_token=" + App.Default.token);
            WebResponse res = req.GetResponse();
            var dataStream = res.GetResponseStream();
            var reader = new StreamReader(dataStream);
            var resString = reader.ReadToEnd();
            reader.Close();
            res.Close();
            resString = HttpUtility.HtmlDecode(resString);

            var token = JToken.Parse(resString);
            audioList = token["response"].Children().Skip(1).Select(x => x.ToObject<Audio>()).ToList();

            this.Invoke((MethodInvoker)delegate
            {
                PlayList = axWindowsMediaPlayer1.playlistCollection.newPlaylist("vkPlayList");

                foreach (var item in audioList)
                {
                    var displayedTitle = item.artist + " - " + item.title;
                    var displayedTitleShort = new string(displayedTitle.Length > 50 ? displayedTitle.Take(50).Concat(new[] { '.', '.', '.' }).ToArray() : displayedTitle.ToArray());

                    var playListItem = axWindowsMediaPlayer1.newMedia(item.url);
                    playListItem.setItemInfo("DisplayedTitle", displayedTitleShort);
                    PlayList.appendItem(playListItem);

                    listBox1.Items.Add(displayedTitle);
                }
                axWindowsMediaPlayer1.currentPlaylist = PlayList;
                axWindowsMediaPlayer1.Ctlcontrols.stop();
            });
        }
        private void backgroundWorker1_DoWork_1(object sender, DoWorkEventArgs e)
        {
            while (!VKLogIn.auth) { Thread.Sleep(500); }

            WebRequest request = WebRequest.Create("https://api.vk.com/method/audio.get?owner_id=" + VKLogIn.vkuserid + "&need_user=0&access_token=" + VKLogIn.acc_token);

            WebResponse response = request.GetResponse();

            Stream dataStream = response.GetResponseStream();

            StreamReader reader = new StreamReader(dataStream);

            string responseFromServer = reader.ReadToEnd();

            reader.Close();

            response.Close();

            responseFromServer = System.Web.HttpUtility.HtmlDecode(responseFromServer);

            JToken token = JToken.Parse(responseFromServer);
            audioList = token["response"].Children().Skip(1).Select(c => c.ToObject<Audio>()).ToList();

            this.Invoke((MethodInvoker)delegate
            {

                PlayList = axWindowsMediaPlayer1.playlistCollection.newPlaylist("vkPlayList");

                for (int i = 0; i < audioList.Count(); i++)
                {
                    Media = axWindowsMediaPlayer1.newMedia(audioList[i].url);
                    PlayList.appendItem(Media);
                    listBox1.Items.Add(audioList[i].artist + " - " + audioList[i].title);
                }
                axWindowsMediaPlayer1.currentPlaylist = PlayList;
                axWindowsMediaPlayer1.Ctlcontrols.stop();
                comboBox1.Enabled = true;
                button1.Text = "Refresh";
                tabControl1.SelectedIndex = 0;
                button4.Visible = true;
                listBox1.Enabled = true;
            });
        }
Esempio n. 33
0
        private void LoadMyMusic()
        {
            Thread.Sleep(TimeSpan.FromSeconds(2));

            this.Dispatcher.BeginInvoke(DispatcherPriority.Normal,
                (ThreadStart)delegate ()
                {
                    MyMusicEngine engineMyMusic = new MyMusicEngine();
                    engineMyMusic.MyMusicLoad();
                    _MyMusicResult = engineMyMusic.MyMusicLoadGetFiles();
                    _MyMusicResultUrls = engineMyMusic.MyMusicGetUrls();

                    MyMusicListWithURLs = activeXMediaPlayerMyMusic.playlistCollection.newPlaylist("MyMusicPlayList");

                    for (int i = 0; i < _MyMusicResultUrls.Count(); i++)
                    {

                        MyMusicURL = activeXMediaPlayerMyMusic.newMedia(_MyMusicResultUrls[i]);
                        MyMusicListWithURLs.appendItem(MyMusicURL);

                    }
                    activeXMediaPlayerMyMusic.currentPlaylist = MyMusicListWithURLs;
                    activeXMediaPlayerMyMusic.Ctlcontrols.stop();

                    ListBoxMyMusic.ItemsSource = engineMyMusic.MyMusicLoadGetFiles();

                }
            );
        }
Esempio n. 34
0
        private void LoadSearcResult()
        {
            Thread.Sleep(TimeSpan.FromSeconds(2));

            this.Dispatcher.BeginInvoke(DispatcherPriority.Normal,
                (ThreadStart)delegate ()
                {
                    SearchEngine engine = new SearchEngine(TextBoxSearch.Text);
                    engine.Search();
                    _Result = engine.GetFiles();
                    _ResultUrls = engine.GetUrls();
                    ListWithURLs = activeXMediaPlayer.playlistCollection.newPlaylist("vkPlayList");

                    for (int i = 0; i < _ResultUrls.Count(); i++)
                    {

                        URL = activeXMediaPlayer.newMedia(_ResultUrls[i]);
                        ListWithURLs.appendItem(URL);

                    }
                    activeXMediaPlayer.currentPlaylist = ListWithURLs;
                    activeXMediaPlayer.Ctlcontrols.stop();

                    ListBoxSearch.ItemsSource = engine.GetFiles();

                }
                );
        }
Esempio n. 35
0
        //сканируем auth
        private void F2()
        {
            while(SetAuth.Default.auth==false) { }

            string method = "audio.get.xml";
            string parametrs = "owner_id";

            string owner = SetAuth.Default.id;

            string token = SetAuth.Default.token;

            string resp = GET_http("https://api.vk.com/method/" +method+"?"+parametrs+"=" +owner+"&v=5.37&access_token=" + token);
            //MessageBox.Show(resp);
            HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
            doc.LoadHtml(resp);
            HtmlNodeCollection Node = doc.DocumentNode.SelectNodes("//title");
            HtmlNodeCollection Node1 = doc.DocumentNode.SelectNodes("//artist");
            HtmlNodeCollection Node2 = doc.DocumentNode.SelectNodes("//url");

            try
            {
                Audio = new string[Node.Count]; // artist + title
                title = new string[Node.Count];
                artist = new string[Node1.Count];
                URL = new string[Node2.Count];
                UrlDownload = new string[Node.Count];

                int il = 0;
                int il1 = 0;
                int il2 = 0;

                PlayList = axWindowsMediaPlayer1.playlistCollection.newPlaylist("Vkontaktik PlayList");

                this.Invoke((MethodInvoker)delegate ()
                {
                    //Достаем title
                    foreach (HtmlNode Data_Node in Node)
                    {
                        title[il] = Data_Node.InnerHtml;
                        il++;
                    }

                    //Достаем artist
                    foreach (HtmlNode Data_Node1 in Node1)
                    {
                        artist[il1] = Data_Node1.InnerHtml;
                        il1++;
                    }

                    foreach (HtmlNode Data_Node2 in Node2)
                    {
                        URL[il2] = Data_Node2.InnerHtml;                  //Достаем URL
                        Media = axWindowsMediaPlayer1.newMedia(URL[il2]); //Записываем URL в media
                        PlayList.appendItem(Media);                       // Добавляем media в playlist

                        UrlDownload[il2] = URL[il2].Split('?')[0];        // Режим Url для загрузки
                        Audio[il2] = artist[il2] + " - " + title[il2];    // склеиваем название

                        il2++;
                    }

                    listBox1.Items.Clear();
                    listBox1.Items.AddRange(Audio);

                    axWindowsMediaPlayer1.currentPlaylist = PlayList;
                    axWindowsMediaPlayer1.Ctlcontrols.stop();

                    timer2.Start();

                    listBox1.SelectedIndex = 0;
                });

            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
        }
Esempio n. 36
0
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            while (!Settings1.Default.auth) { Thread.Sleep(500); }

            WebRequest request =
               WebRequest.Create("https://api.vk.com/method/audio.get?ower_id" + Settings1.Default.id + "&need_user=0&access_token=" + Settings1.Default.token);
            WebResponse response = request.GetResponse();
            Stream dataStream = response.GetResponseStream();
            StreamReader reader = new StreamReader(dataStream);
            string responseFromServer = reader.ReadToEnd();
            reader.Close();
            response.Close();
            responseFromServer = HttpUtility.HtmlDecode(responseFromServer);

            JToken token = JToken.Parse(responseFromServer);
            audioList = Enumerable.Skip(token["response"].Children(), 0).Select(c => c.ToObject<Audio>()).ToList();

            this.Invoke((MethodInvoker)delegate
            {
                PlayList = axWindowsMediaPlayer1.playlistCollection.newPlaylist("vkPlayList");
                for (int i = 0; i < audioList.Count(); i++)
                {
                    Media = axWindowsMediaPlayer1.newMedia(audioList[i].url);
                    PlayList.appendItem(Media);
                    listBox1.Items.Add(audioList[i].artist + " - " + audioList[i].title);
                }
                axWindowsMediaPlayer1.currentPlaylist = PlayList;
                axWindowsMediaPlayer1.settings.setMode("loop", false);
                axWindowsMediaPlayer1.settings.setMode("shuffle", false);
                axWindowsMediaPlayer1.Ctlcontrols.stop();
            });
        }