Initilize widget setting without starting its host

This commit is contained in:
TheXamlGuy
2024-01-31 22:33:23 +00:00
parent a2a5591502
commit 6dbe2db584
25 changed files with 125 additions and 83 deletions
+5 -3
View File
@@ -2,8 +2,9 @@
namespace Hyperbar.Widget;
public class WidgetExtensionHandler(IProxyServiceCollection<IWidgetBuilder> typedServices,
IServiceProvider provider) :
public class WidgetExtensionHandler(IServiceProvider provider,
IMediator mediator,
IProxyServiceCollection<IWidgetBuilder> typedServices) :
INotificationHandler<Created<WidgetExtension>>
{
public async Task Handle(Created<WidgetExtension> notification,
@@ -21,7 +22,8 @@ public class WidgetExtensionHandler(IProxyServiceCollection<IWidgetBuilder> type
});
IWidgetHost host = builder.Build();
await host.InitializeAsync();
await mediator.PublishAsync(new Created<IWidgetHost>(host),
cancellationToken);
}
}
}