Files
Hyperbar/Hyperbar.Widget.Primary.Windows/PrimaryWidget.cs
T
TheXamlGuy a2a5591502 bla
2024-01-30 22:34:49 +00:00

35 lines
1.4 KiB
C#

using Hyperbar.Widget;
using Microsoft.Extensions.DependencyInjection;
namespace Hyperbar.Widget.Primary.Windows;
public class PrimaryWidget :
IWidget
{
public IWidgetBuilder Create() =>
WidgetBuilder.Create()
.UseConfiguration<PrimaryWidgetConfiguration>(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>()
.AddWidgetTemplate<PrimaryWidgetViewModel>()
.AddHandler<WidgetComponentViewModelEnumerator>()
.AddHandler<PrimaryWidgetConfigurationHandler>();
});
}