Files
Hyperbar/Hyperbar.Windows.Primary/PrimaryWidgetProvider.cs
T
TheXamlGuy 4766ed1156 wip
2024-01-18 23:55:02 +00:00

19 lines
956 B
C#

using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
namespace Hyperbar.Windows.Primary;
public class PrimaryWidgetProvider :
IWidgetProvider
{
public void Create(HostBuilderContext comtext, IServiceCollection services) =>
services.AddConfiguration<PrimaryWidgetConfiguration>()
.AddCache<(Guid ParentId, Guid Id), PrimaryCommandConfiguration>()
.AddCache<Guid, IWidgetComponentViewModel>()
.AddTransient<IProvider<PrimaryCommandConfiguration, IWidgetComponentViewModel?>, WidgetComponentViewModelProvider>()
.AddTransient<IFactory<PrimaryCommandConfiguration, IWidgetComponentViewModel?>, WidgetComponentViewModelFactory>()
.AddTransient<IViewModelEnumerator<IWidgetComponentViewModel>, WidgetComponentViewModelEnumerator>()
.AddWidgetTemplate<PrimaryWidgetViewModel>()
.AddHandler<PrimaryWidgetConfigurationHandler>();
}