private void UpdateTasks(ExportChangedEventArgs e) { var taskMeta = e.Metadata[TaskManager.TaskNameMetadataKey] as TaskMetadata; if (taskMeta == null) { return; } var taskName = taskMeta.Name; switch (e.Type) { case ExportChangeType.Added: var task = ResolveTask(taskName); Tasks.AddTask(taskName, task); break; case ExportChangeType.Removed: default: Tasks.RemoveTask(taskName); break; } }
/// <summary> /// The on exports changed. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="e"> /// The e. /// </param> private void OnExportsChanged(object sender, ExportChangedEventArgs e) { Contract.Requires<ArgumentNullException>(sender != null, "sender"); EventHandler<ExportChangedEventArgs> handler = ExportsChanged; if (handler != null) handler(sender, e); }
/// <summary> /// The exports changed. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="e"> /// The e. /// </param> private void ExportsChanged(object sender, ExportChangedEventArgs e) { Contract.Requires<ArgumentNullException>(sender != null, "sender"); IEnumerable<BuildObject> parts = RebuildManager.GetAffectedParts(e.Added, e.Removed); var errors = new List<ErrorTracer>(); foreach (BuildObject buildObject in parts) { var errorTracer = new ErrorTracer(); BuildUp(buildObject, errorTracer, buildObject.BuildParameters); if(errorTracer.Exceptional) errors.Add(errorTracer); } if(errors.Count != 0) throw new AggregateException(errors.Select(err => new BuildUpException(err))); }