tidy up
This commit is contained in:
@@ -29,7 +29,7 @@ public class WidgetExtensionEnumerator(IFactory<Type, IWidget> factory,
|
||||
{
|
||||
if (factory.Create(widgetType) is IWidget widget)
|
||||
{
|
||||
await mediator.PublishAsync(new Created<WidgetExtension>(new WidgetExtension(widget,
|
||||
await mediator.PublishAsync(new Create<WidgetExtension>(new WidgetExtension(widget,
|
||||
new WidgetAssembly(assembly))), cancellationToken);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,9 +5,9 @@ namespace Hyperbar.Widget;
|
||||
public class WidgetExtensionHandler(IServiceProvider provider,
|
||||
IMediator mediator,
|
||||
IProxyServiceCollection<IWidgetBuilder> typedServices) :
|
||||
INotificationHandler<Created<WidgetExtension>>
|
||||
INotificationHandler<Create<WidgetExtension>>
|
||||
{
|
||||
public async Task Handle(Created<WidgetExtension> notification,
|
||||
public async Task Handle(Create<WidgetExtension> notification,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
if(notification.Value is WidgetExtension widgetExtension)
|
||||
@@ -22,7 +22,7 @@ public class WidgetExtensionHandler(IServiceProvider provider,
|
||||
});
|
||||
|
||||
IWidgetHost host = builder.Build();
|
||||
await mediator.PublishAsync(new Created<IWidgetHost>(host),
|
||||
await mediator.PublishAsync(new Create<IWidgetHost>(host),
|
||||
cancellationToken);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
namespace Hyperbar.Widget;
|
||||
|
||||
public class WidgetHostHandler :
|
||||
INotificationHandler<Created<IWidgetHost>>
|
||||
INotificationHandler<Create<IWidgetHost>>
|
||||
{
|
||||
public async Task Handle(Created<IWidgetHost> notification,
|
||||
public async Task Handle(Create<IWidgetHost> notification,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
if (notification.Value is IWidgetHost host)
|
||||
|
||||
@@ -12,7 +12,7 @@ public class WidgetStartedHandler(IMediator mediator) :
|
||||
{
|
||||
if (host.Services.GetService<IWidgetViewModel>() is IWidgetViewModel viewModel)
|
||||
{
|
||||
await mediator.PublishAsync(new Created<IWidgetViewModel>(viewModel),
|
||||
await mediator.PublishAsync(new Create<IWidgetViewModel>(viewModel),
|
||||
nameof(IWidgetHostViewModel), cancellationToken);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ public class WidgetViewModelEnumerator(IWidgetHost host,
|
||||
{
|
||||
foreach (IWidgetViewModel viewModel in viewModels)
|
||||
{
|
||||
await mediator.PublishAsync(new Created<IWidgetViewModel>(viewModel),
|
||||
await mediator.PublishAsync(new Create<IWidgetViewModel>(viewModel),
|
||||
nameof(IWidgetHostViewModel), cancellationToken);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user