Нужно запустить N количество параллельных потоков и из них выводить данные в форму (ListBox) интерактивно. Вот приблизительно что получается:
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private string name;
private static List<string> listing = new List<string>();
private void button1_Click(object sender, EventArgs e)
{
for (int i=1 ; i<5; i++)
{
name = i.ToString();
Work w = new Work(name);
Thread t = new Thread(new ThreadStart(w.DoWork));
t.Start();
}
}
class Work
{
private string m_name;
public Work(string name)
{
m_name = name;
}
public void DoWork()
{
for (int x = 0; x < 10; x++)
{
Form1.listing.Add(string.Format("Thread is working: {0} - Cycle: {1}", m_name, x));
// Form1.list1.Items.Add(string.Format("Thread is working: {0} - Cycle: {1}", m_name, x));
}
}
}
private void button2_Click(object sender, EventArgs e)
{
list1.DataSource = listing;
}
}