#region 事件相关
/// <summary>
/// 全部完成事件
/// </summary>
public event Action<CompetedEventArgs> AllCompleted;
/// <summary>
/// 单个完成事件
/// </summary>
public event Action<T, CompetedEventArgs> OneCompleted;
/// <summary>
/// 引发全部完成事件
/// </summary>
/// <param name="args"></param>
private void OnAllCompleted(CompetedEventArgs args)
{
if (AllCompleted != null)
{
try
{
AllCompleted(args);//全部完成事件
}
catch { }
}
}
/// <summary>
/// 引发单个完成事件
/// </summary>
/// <param name="pendingValue"></param>
/// <param name="args"></param>
private void OnOneCompleted(T pendingValue, CompetedEventArgs args)
{
if (OneCompleted != null)
{
try
{
OneCompleted(pendingValue, args);
}
catch { }
}
}
#endregion
#region 构造
public QueueThreadBase(IEnumerable<T> collection)