break widget related stuff into its own project as the main HB project was just becoming too bloated

This commit is contained in:
TheXamlGuy
2024-01-24 20:50:59 +00:00
parent d1b57d5d16
commit 5e26e97f6b
61 changed files with 178 additions and 95 deletions
+26
View File
@@ -0,0 +1,26 @@
namespace Hyperbar.Widget;
public class WidgetHostHandler(IMediator mediator,
IFactory<IWidgetHost, WidgetContainerViewModel?> factory) :
INotificationHandler<Started<IWidgetHost>>,
INotificationHandler<Stopped<IWidgetHost>>
{
public async Task Handle(Started<IWidgetHost> notification,
CancellationToken cancellationToken)
{
if (notification.Value is IWidgetHost host)
{
if (factory.Create(host) is WidgetContainerViewModel containerViewModel)
{
await mediator.PublishAsync(new Created<WidgetContainerViewModel>(containerViewModel),
nameof(WidgetBarViewModel), cancellationToken);
}
}
}
public Task Handle(Stopped<IWidgetHost> notification,
CancellationToken cancellationToken)
{
throw new NotImplementedException();
}
}