代码
using System;
using System.Threading;
public delegate void LoadingProgressCallback(double PercentComplete,string ItemName);
public delegate void LoadCompleteCallback(int ItemID, string ItemName);
public static class Program
{
public static void Main(string[] args)
{
LoadTest loadTest = new LoadTest();
loadTest.LoadItems(args);
}
}
public class LoadTest
{
ManualResetEvent resetEvent;
int numThreads = 0;
public LoadTest()
{}
public void LoadItems(string[] Items)
{
numThreads = 0;
resetEvent = new ManualResetEvent(false);
foreach(string item in Items)
{
Console.WriteLine("Adding {0} to ThreadPool",item);
ThreadPool.QueueUserWorkItem
(
delegate
{
Load(item, this.progCall, this.compCall);
}
); …
Run Code Online (Sandbox Code Playgroud)