break widget related stuff into its own project as the main HB project was just becoming too bloated
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
namespace Hyperbar.Widget;
|
||||
|
||||
public class WidgetContainerFactory(IServiceFactory factory) :
|
||||
IFactory<IWidgetHost, WidgetContainerViewModel?>
|
||||
{
|
||||
public WidgetContainerViewModel? Create(IWidgetHost value)
|
||||
{
|
||||
if (value.Services.GetServices<IWidgetViewModel>() is
|
||||
IEnumerable<IWidgetViewModel> viewModels)
|
||||
{
|
||||
return factory.Create<WidgetContainerViewModel>(value.Configuration.Id);
|
||||
}
|
||||
|
||||
return default;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user