Files
Hyperbar/Hyperbar.Windows.Primary/PrimaryWidget.cs
T
2024-01-21 19:59:32 +00:00

23 lines
1.0 KiB
C#

using Microsoft.Extensions.DependencyInjection;
namespace Hyperbar.Windows.Primary;
public class PrimaryWidget :
IWidget
{
public IWidgetBuilder Create() =>
WidgetBuilder.Configure<PrimaryWidgetConfiguration>(args =>
{
args.Id = Guid.Parse("cfdfe07c-d9d6-4174-ae41-988ca24d2e10");
args.Name = "Primary commands";
}).ConfigureServices(services =>
{
services.AddCache<(Guid ParentId, Guid Id), PrimaryCommandConfiguration>()
.AddCache<Guid, IWidgetComponentViewModel>()
.AddTransient<IProvider<PrimaryCommandConfiguration, IWidgetComponentViewModel?>, WidgetComponentProvider>()
.AddTransient<IFactory<PrimaryCommandConfiguration, IWidgetComponentViewModel?>, WidgetComponentFactory>()
.AddTransient<IEnumerator<IWidgetComponentViewModel>, WidgetComponentEnumerationHandler>()
.AddWidgetTemplate<PrimaryWidgetViewModel>()
.AddHandler<PrimaryWidgetConfigurationHandler>();
});
}