public Task createTask(string url, string dir, string fileName) { DownloadTask task = new DownloadTask(url, dir, fileName); task.setStatus(TaskStatus.Waiting); task.onTaskStatusChanged += this.OnTaskStatusChanged; task.id = currId+""; currId++; lock(lockObj){ waittingTasks.Add(task); allTasks.Add(task); } return task; }