private void InformListeners(TaskReport task) { //the root task executes this if (m_taskUpdate != null) { m_taskUpdate(task); } //all children tasks execute this else if (m_owningTask != null) { m_owningTask.InformListeners(this); } }
internal TaskReport AddSubTask(string description) { CheckDisposed(); Debug.Assert(m_phase != TaskPhase.Finished); var t = new TaskReport(description, this); if (m_subTasks == null) { m_subTasks = new List <TaskReport>(); } else { //a new set task should not be added until the previous one is finished. TaskPhase phase = m_subTasks[m_subTasks.Count - 1].Phase; Debug.Assert(phase == TaskPhase.Finished); // || phase == TaskPhase.ErrorEncountered); } m_subTasks.Add(t); //this cannot be in the constructor because if the listener asks //for the most recent task, it will not get this one until after //this has been added to the subtasks list. t.InformListeners(TaskPhase.Started); return(t); }
internal TaskReport AddSubTask (string description) { CheckDisposed(); Debug.Assert( m_phase != TaskPhase.finished); TaskReport t = new TaskReport(description, this); if (m_subTasks == null) m_subTasks = new List<TaskReport>(); else { //a new set task should not be added until the previous one is finished. TaskPhase phase = m_subTasks[m_subTasks.Count - 1].Phase; Debug.Assert( phase == TaskPhase.finished);// || phase == TaskPhase.errorEncountered); } m_subTasks.Add(t); //this cannot be in the constructor because if the listener asks //for the most recent task, it will not get this one until after //this has been added to the subtasks list. t.InformListeners (TaskPhase.started); return t; }