/// <summary> /// Detaches the currently attached <see cref="IBuildListener" /> instances /// from the <see cref="Project" />. /// </summary> public void DetachBuildListeners() { foreach (IBuildListener listener in BuildListeners) { BuildStarted -= new BuildEventHandler(listener.BuildStarted); BuildFinished -= new BuildEventHandler(listener.BuildFinished); TargetStarted -= new BuildEventHandler(listener.TargetStarted); TargetFinished -= new BuildEventHandler(listener.TargetFinished); TaskStarted -= new BuildEventHandler(listener.TaskStarted); TaskFinished -= new BuildEventHandler(listener.TaskFinished); MessageLogged -= new BuildEventHandler(listener.MessageLogged); if (typeof(IBuildLogger).IsAssignableFrom(listener.GetType())) { ((IBuildLogger)listener).Flush(); } } BuildListeners.Clear(); }
/// <summary> /// Creates the default <see cref="IBuildLogger" /> and attaches it to /// the <see cref="Project" />. /// </summary> public void CreateDefaultLogger() { IBuildLogger buildLogger = new DefaultLogger(); // hook up to build events BuildStarted += new BuildEventHandler(buildLogger.BuildStarted); BuildFinished += new BuildEventHandler(buildLogger.BuildFinished); TargetStarted += new BuildEventHandler(buildLogger.TargetStarted); TargetFinished += new BuildEventHandler(buildLogger.TargetFinished); TaskStarted += new BuildEventHandler(buildLogger.TaskStarted); TaskFinished += new BuildEventHandler(buildLogger.TaskFinished); MessageLogged += new BuildEventHandler(buildLogger.MessageLogged); // set threshold of logger equal to threshold of the project buildLogger.Threshold = Threshold; // add default logger to list of build listeners BuildListeners.Add(buildLogger); }
public WorkbookBuilder AddOnRowCellCreated(BuildEventHandler onRowCellCreated) { OnRowCellCreated += onRowCellCreated; return(this); }
/// <summary> /// Attaches the specified build listeners to the <see cref="Project" />. /// </summary> /// <param name="listeners">The <see cref="IBuildListener" /> instances to attach to the <see cref="Project" />.</param> /// <remarks> /// The currently attached <see cref="IBuildListener" /> instances will /// be detached before the new <see cref="IBuildListener" /> instances /// are attached. /// </remarks> public void AttachBuildListeners(BuildListenerCollection listeners) { // detach currently attached build listeners DetachBuildListeners(); foreach (IBuildListener listener in listeners) { // hook up listener to project build events BuildStarted += new BuildEventHandler(listener.BuildStarted); BuildFinished += new BuildEventHandler(listener.BuildFinished); TargetStarted += new BuildEventHandler(listener.TargetStarted); TargetFinished += new BuildEventHandler(listener.TargetFinished); TaskStarted += new BuildEventHandler(listener.TaskStarted); TaskFinished += new BuildEventHandler(listener.TaskFinished); MessageLogged += new BuildEventHandler(listener.MessageLogged); // add listener to project listener list BuildListeners.Add(listener); } }
/// <summary> /// Detaches the currently attached <see cref="IBuildListener" /> instances /// from the <see cref="Project" />. /// </summary> public void DetachBuildListeners() { foreach (IBuildListener listener in BuildListeners) { BuildStarted -= new BuildEventHandler(listener.BuildStarted); BuildFinished -= new BuildEventHandler(listener.BuildFinished); TargetStarted -= new BuildEventHandler(listener.TargetStarted); TargetFinished -= new BuildEventHandler(listener.TargetFinished); TaskStarted -= new BuildEventHandler(listener.TaskStarted); TaskFinished -= new BuildEventHandler(listener.TaskFinished); MessageLogged -= new BuildEventHandler(listener.MessageLogged); IBuildLogger buildLogger = listener as IBuildLogger; if (buildLogger != null) { buildLogger.Flush(); } } BuildListeners.Clear(); }