/// <summary> /// Initialise an <see cref="ItemStatus"/>. /// </summary> /// <param name="newStatus">The new status.</param> public override void InitialiseStatus(ItemBuildStatus newStatus) { // Do not re-initialise if the status is already set if ((this.CurrentStatus == null) || (this.CurrentStatus.Status != newStatus)) { // This needs to be called first, otherwise the status is not set up taskStatuses.Clear(); base.InitialiseStatus(newStatus); // Add each status if (Tasks != null) { foreach (ITask task in Tasks) { ItemStatus taskItem = null; var tbase = task as TaskBase; if (tbase != null) { // Reset the status for the task tbase.InitialiseStatus(newStatus); } var dummy = task as IStatusSnapshotGenerator; if (dummy != null) { taskItem = dummy.GenerateSnapshot(); } else { taskItem = new ItemStatus(task.GetType().Name); taskItem.Status = newStatus; } // Only add the item if it has been initialised if (taskItem != null) { CurrentStatus.AddChild(taskItem); taskStatuses.Add(task, taskItem); } } } } }