المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Where i wrong???



C# Programming
03-31-2009, 07:40 PM
Hi
i'm getting exhausted about a simple feature but sincerely i don't know how work out that http://www.barakasoft.com/script/Forums/Images/smiley_frown.gif
I have this code to use Window Media Player :

public partial class Form1 : Form
{

TextBox textbox;
public Form1()
{
InitializeComponent();
listBox1.SelectedIndexChanged += listBox1_SelectedIndexChanged;
textbox = new TextBox { Dock = DockStyle.Top };
listBox1.SelectionMode = SelectionMode.MultiExtended;
}

private void Form1_Load(object sender, EventArgs e)
{
List prova = GetListOfFiles(@"D:\\Torrent\\Depeche Mode - Sounds Of The Universe (2009)\\");

listBox1.DataSource = prova;
listBox1.DisplayMember = "prova";
player1.settings.setMode("Shuffle", true);
player1.Ctlcontrols.play();

}

private List GetListOfFiles(string Folder)
{
DirectoryInfo dir = new DirectoryInfo(Folder);
FileInfo[] files = dir.GetFiles("*.mp3", SearchOption.AllDirectories);
List str = new List();
foreach (FileInfo file in files)
{
str.Add(file.FullName);

}
return str;
}

private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
Text = Convert.ToString(listBox1.SelectedItem);
player1.URL = Convert.ToString(listBox1.SelectedItem);
}

private void textBox1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Return)
{
string searchFor = textBox1.Text;
List strings = (List s.Contains(searchFor));
}
}
}


}


With this code i can search songs and show in a ListBox the list downloaded in a folder but my purpose is when Window Music Player change song automatically the ListBoxItem will change marker and show the current song instead now when WMP change song the marker of the listBox did not move .
An important characteristic is the i set the WPM in RandomPlay it is a feature requested.
Do you have any idea how i can work out that from some day i felt a little confuse to find out the right way but not luck.
Have a good luck.

Nice Regards