Wire up the disposer for cleaning up unused objects, i.e disposing a VM will remove it from the view

This commit is contained in:
TheXamlGuy
2024-01-12 21:05:42 +00:00
parent 814c806240
commit 2a773f26db
37 changed files with 323 additions and 206 deletions
@@ -0,0 +1,14 @@
namespace Hyperbar.Windows.Primary;
public class WidgetComponentViewModelEnumerator(PrimaryWidgetConfiguration configuration,
IViewModelFactory<PrimaryCommandConfiguration, IWidgetComponentViewModel?> factory) :
IViewModelEnumerator<IWidgetComponentViewModel>
{
public async IAsyncEnumerable<IWidgetComponentViewModel?> Next()
{
foreach (PrimaryCommandConfiguration item in configuration)
{
yield return await factory.CreateAsync(item);
}
}
}