private void UpdateWidget(Widget widget)
{
if (widget.Dependencies == null || !widget.Dependencies.Any())
{
widget.Update();
return;
}
var parameters = new object[widget.Dependencies.Count()];
int index = 0;
foreach (Type dependencyType in widget.Dependencies)
{
if (!this.availableDependencies.ContainsKey(dependencyType))
{
// If you get an exception here first check the InitialiseSupportedDependenciesArray method.
throw new NotSupportedException(
string.Format(
CultureInfo.CurrentCulture,
"The requested dependency {0} for the widget {1} is not supported.",
dependencyType.Name,
widget.Name));
}
parameters[index++] = this.availableDependencies[dependencyType];
}
widget.Update(parameters);
}