WIP
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
using Toolkit.Foundation;
|
||||
|
||||
namespace Bitvault;
|
||||
|
||||
public class SynchronizeItemCategoryViewModelHandler(IItemConfigurationCollection configurations,
|
||||
IServiceFactory serviceFactory,
|
||||
IPublisher publisher) :
|
||||
INotificationHandler<SynchronizeEventArgs<ItemCategoryNavigationViewModel>>
|
||||
{
|
||||
public Task Handle(SynchronizeEventArgs<ItemCategoryNavigationViewModel> args)
|
||||
{
|
||||
bool selected = true;
|
||||
foreach (KeyValuePair<string, Func<ItemConfiguration>> configuration in configurations)
|
||||
{
|
||||
if (serviceFactory.Create<ItemCategoryNavigationViewModel>(configuration.Key, selected)
|
||||
is ItemCategoryNavigationViewModel viewModel)
|
||||
{
|
||||
publisher.Publish(Create.As(viewModel), nameof(ItemCategoryCollectionViewModel));
|
||||
selected = false;
|
||||
}
|
||||
}
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user