public void Play(Song song) { try { Stop(); File.WriteAllBytes("temp\\" + song.Name, song.Data); } catch (IOException) { return; } PlayingIndex = Songs.IndexOf(song); player.URL = "temp\\" + song.Name; player.controls.play(); }
private void BTN_Add_Click(object sender, EventArgs e) { OpenFileDialog dlg = new OpenFileDialog(); dlg.Multiselect = true; if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { WaitingForm form = new WaitingForm(); form.Show(); Application.DoEvents(); for (int i = 0; i < dlg.FileNames.Count(); i++) { byte[] data = File.ReadAllBytes(dlg.FileNames[i]); Song song = new Song() { Data = data, Name = dlg.SafeFileNames[i] }; Songbundle.Songs.Add(song); LIST_Songs.Items.Add(song); } form.Close(); } }