Hi im working for simple media player, and i got a problem with my checkbox its not shuffling item...
here's my following code
listbox1
private void listBox1_SelectedIndexChanged_1(object sender, EventArgs e)
{
blumemediaplayer.Ctlcontrols.play();
MediaFile file = listBox1.SelectedItem as MediaFile;
if (file != null)
{
wmp.URL = file.Path;
wmp.Ctlcontrols.play();
}
}
checkbox for shuffling selected items but, its not working
bool IsShuffle = false;
MediaFile file = listBox1.SelectedItem as MediaFile;
if (checkBox2.Checked==true)
{
if (wmp.playState == WMPPlayState.wmppsPlaying)
{
// do nothing in this case since song is still playing
}
else
{
if (IsShuffle)
{
Random rand = new Random();
listBox1.SelectedIndex = rand.Next(0, listBox1.Items.Count - 1);
}
else
{
if (listBox1.SelectedIndex + 1 <= listBox1.Items.Count - 1)
{
listBox1.SelectedIndex = listBox1.SelectedIndex + 1;
}
else
{
listBox1.SelectedIndex = 0;
}
}
wmp.URL = file.Path;
}
}
thank you :)