A widget should have only one IWidgetViewModel by default... wondering whether if we should go for the first served, or throw if multiple detected, or ignore the widget
This commit is contained in:
@@ -7,28 +7,29 @@ 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>()
|
||||
.AddWidgetTemplate<PrimaryWidgetViewModel>()
|
||||
.AddHandler<WidgetComponentViewModelEnumerator>()
|
||||
.AddHandler<PrimaryWidgetConfigurationHandler>();
|
||||
});
|
||||
WidgetBuilder.Create()
|
||||
.Configuration<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>();
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user