Added ICollectionSynchronization

This commit is contained in:
TheXamlGuy
2024-06-04 12:14:00 +01:00
parent 0842988dc3
commit 554c12382a
44 changed files with 149 additions and 116 deletions
+2 -2
View File
@@ -18,7 +18,7 @@ public class ItemModifiedHandler(IServiceProvider serviceProvider,
if (cachedItem is not null)
{
IServiceScope serviceScope = serviceProvider.CreateScope();
IValueStore<Item<(Guid, string)>> valueStore = serviceScope.ServiceProvider.GetRequiredService<IValueStore<Item<(Guid, string)>>>();
IDecoratorService<Item<(Guid, string)>> decoratorService = serviceScope.ServiceProvider.GetRequiredService<IDecoratorService<Item<(Guid, string)>>>();
int oldIndex = cache.IndexOf(cachedItem);
cache.Remove(cachedItem);
@@ -26,7 +26,7 @@ public class ItemModifiedHandler(IServiceProvider serviceProvider,
cache.Add(newItem);
int newIndex = cache.IndexOf(newItem);
valueStore.Set(newItem);
decoratorService.Set(newItem);
publisher.Publish(MoveTo.As<ItemNavigationViewModel>(oldIndex, newIndex),
nameof(ItemCollectionViewModel));