c# - Play a list of songs with media player on WinForm -
namespace windowsformsapplication1 { public partial class form1 : form { public form1() { initializecomponent(); } string[] nomi, percorsi; //nomi means names , percorsi means paths. i'm italian, that's why private void apri_click(object sender, eventargs e) { openfiledialog apri = new openfiledialog(); apri.filter = "file *.mp3|*.mp3"; apri.multiselect = true; dialogresult scelta = apri.showdialog(); if (scelta == dialogresult.ok) { nomi = apri.safefilenames; percorsi = apri.filenames; (int = 0; < nomi.length; i++) files.items.add(nomi[i]); } } private void files_selectedindexchanged(object sender, eventargs e) { player.url = percorsi[files.selectedindex]; } } }
i have code create simple mp3 player. there wayy enable previous/next buttons on media player , play next/previous song in listbox? , there way find if song ended can play next one? in advance!
private void player_playstatechange(object sender, axwmplib._wmpocxevents_playstatechangeevent e) { if (e.newstate == 8) { } }
found solution. i'll post maybe else. e.newstate == 8 true if song finished, can start playing next song.
Comments
Post a Comment