using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.Serialization;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using IReaper.CourseData;
namespace IReaper.FileData{
/// <summary>
///
/// </summary>
public class RunningCourseFileDataCollection : CourseFileDataCollection
{
#region static region
#endregion
bool _isHook;
/// <summary>
///
/// </summary>
/// <param name="isHook"></param>
public RunningCourseFileDataCollection(bool isHook)
: base()
{
if (!isHook)
{
this.RemoveHook();
}
this._isHook = isHook;
}
/// <summary>
///
/// </summary>
/// <param name="Data"></param>
[MethodImpl(MethodImplOptions.Synchronized)]
protected override void CourseFileData_StatueChange(CourseFileData Data)
{
int index = -1;
if (Data.RunState == RunningStatue.Created ||
Data.RunState == RunningStatue.Finished)
{
lock (this)//
{
if (this.Contains(Data))
{
this.Remove(Data);
}
}
}
else if ((index = this.IndexOf(Data)) >= 0)
{
this.ResetItem(index);
}
else if (Data.RunState == RunningStatue.RunRequest ||
Data.RunState == RunningStatue.Running)
{
this.Add(Data);
this.ResetItem(this.Count - 1);
}
}
/// <summary>
/// <seealso cref="BindingList"/>
/// </summary>
/// <param name="Data"></param>
public new void Add(CourseFileData Data)
{
if (this.Contains(Data))
{
return;
}
base.Add(Data);
}
}
}
|