protected void RaiseTaskEndEvent(DownloadTaskInfo taskInfo) { EventHandler <TaskEndArgs> temp = Interlocked.CompareExchange(ref TaskEndEvent, null, null); if (temp != null) { temp(this, new TaskEndArgs(taskInfo)); } }
/// <summary> /// find task by md5 /// </summary> /// <param name="md5"></param> /// <param name="info">receive task info</param> /// <returns>return true when found</returns> public Boolean FindTask(String md5, out DownloadTaskInfo info) { lock (m_lock) { Task task; if (m_taskMap.TryGetValue(md5, out task)) { info = task.ToDownloadTaskInfo(); return(true); } } info = new DownloadTaskInfo(); return(false); }
public TaskEndArgs(DownloadTaskInfo taskInfo) { m_taskInfo = taskInfo; }