Files
Hyperbar/Hyperbar.Windows.Primary/PrimaryWidget.cs
T
2024-01-23 21:41:47 +00:00

33 lines
1.3 KiB
C#

using Microsoft.Extensions.DependencyInjection;
namespace Hyperbar.Windows.Primary;
public class PrimaryWidget :
IWidget
{
public IWidgetBuilder Create() =>
WidgetBuilder<PrimaryWidgetConfiguration>.Configure(args =>
{
args.Name = "Primary commands";
args.Commands =
[
new KeyAcceleratorCommandConfiguration
{
Id = Guid.NewGuid(),
Order = 0,
Text = "Test",
Icon = "dd",
Key = 1
}
];
}).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>();
});
}