Ejemplo n.º 1
0
        /// <summary>
        /// 删除给定的任务
        /// </summary>
        /// <param name="task"></param>
        public void Remove(Downloader task)
        {
            if (task.State!=DownloadState.NeedToPrepare ||
                task.State!=DownloadState.paused ||
                task.State!=DownloadState.Ended)
            {
                task.Pause();
            }

            using (locker.LockList(false))
            {
                downloads.Remove(task);
            }

            OnDownloadRemove(task);
        }