Пример #1
0
        public void AddSongs(Powerhour Powerhour)
        {
            var openFilesDialog = new OpenFileDialog {
                Filter = "MP3 (.mp3)|*.mp3",
                Multiselect = true
            };

            if (openFilesDialog.ShowDialog() == true) {

                foreach (var file in openFilesDialog.Files) {

                    var song = new Song(file.FullName);
                    var songSample = new SongSample(song);
                    Powerhour.SongSamples.Add(songSample);
                }
            }
        }
Пример #2
0
        private void PlaySong(SongSample currentSong)
        {
            if (currentFileStream != null) {
                currentFileStream.Dispose();
            }

            mediaElement.Stop();
            currentFileStream = new FileStream(currentSong.Song.FilePath, FileMode.Open);
            mediaElement.SetSource(currentFileStream);
            mediaElement.Play();
        }