lots of tidying up

This commit is contained in:
TheXamlGuy
2024-01-25 20:33:55 +00:00
parent 5e26e97f6b
commit a322893166
20 changed files with 115 additions and 123 deletions
+15 -5
View File
@@ -1,11 +1,21 @@
namespace Hyperbar.Widget;
using Microsoft.Extensions.DependencyInjection;
public class WidgetViewModelEnumerator :
namespace Hyperbar.Widget;
public class WidgetViewModelEnumerator(IWidgetHost host,
IMediator mediator) :
INotificationHandler<Enumerate<IWidgetViewModel>>
{
public Task Handle(Enumerate<IWidgetViewModel> notification,
public async Task Handle(Enumerate<IWidgetViewModel> notification,
CancellationToken cancellationToken)
{
throw new NotImplementedException();
}
if (host.Services.GetServices<IWidgetViewModel>() is IEnumerable<IWidgetViewModel> viewModels)
{
foreach (IWidgetViewModel viewModel in viewModels)
{
await mediator.PublishAsync(new Created<IWidgetViewModel>(viewModel),
nameof(WidgetContainerViewModel), cancellationToken);
}
}
}
}