private UpdateWidgetCollectionWithNewAddition ( |
||
baseWidget | ||
return |
private Widget UpdateWidgetCollectionWithNewAddition(Widget baseWidget)
{
var widgetGroup = WidgetGroups.FirstOrDefault(group => @group.Heading == baseWidget.Category);
if (widgetGroup == null)
{
widgetGroup = new WidgetGroup
{
Heading = baseWidget.Category,
Widgets = new ObservableCollection<Widget>()
};
WidgetGroups.Add(widgetGroup);
}
widgetGroup.Widgets.Add(baseWidget);
UpdateAllWidgets();
return baseWidget;
}
}