/// <summary> /// Button open /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void _buttonCalculate_Click(object sender, EventArgs e) { openFileDialog1.Multiselect = true; if (openFileDialog1.ShowDialog() == DialogResult.OK) { foreach (var filename in openFileDialog1.FileNames) { _currentSong = new SongData() { FullName = filename }; bool exists = false; foreach (var item in _songCollection) { if (item.FullName == _currentSong.FullName) { exists = true; break; } } if (!exists) _newSongCollection.Add(_currentSong); } if(_newSongCollection.Count > 0) { MoveNextSong(); } else { MessageBox.Show("This song is already in the playlist.", "Song already in the playlist.", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
/// <summary> /// Get BPMs from the next song /// </summary> private void MoveNextSong() { if (_currentPosition == _newSongCollection.Count) return; _currentSong = _newSongCollection[_currentPosition]; PlayMusic(); timer1.Start(); }