Esempio n. 1
0
 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;
 }
Esempio n. 2
0
        public JB_offscreen(JB_screen jb_screen)
        {
            InitializeComponent();

            this.jb_screen         = jb_screen;
            this.jb_screen.Resize += new System.EventHandler(this.JB_screen_Resize);
            mediaP_controls        = (WMPLib.IWMPControls3)mediaP.Ctlcontrols;

            timer.Tick    += new EventHandler(timer_Tick);
            timer.Interval = 100;
            timer.Enabled  = true;
            timer.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 ;___;");
            }
        }