Files
Walleby/Wallet/UnarchiveItemHandler.cs
T
TheXamlGuy bc5023c8ac Bug fixes
2024-07-05 21:57:01 +01:00

30 lines
803 B
C#

using Toolkit.Foundation;
namespace Wallet;
public class UnarchiveItemHandler(IDecoratorService<Item<(Guid, string)>> decoratorService,
ICache<Item<(Guid, string)>> cache,
IMediator mediator,
IPublisher publisher) :
INotificationHandler<UnarchiveEventArgs<Item>>
{
public async Task Handle(UnarchiveEventArgs<Item> args)
{
try
{
if (decoratorService.Value is Item<(Guid, string)> item)
{
(Guid id, string name) = item.Value;
await mediator.Handle<UpdateEventArgs<(Guid, int)>,
bool>(new UpdateEventArgs<(Guid, int)>((id, 0)));
cache.Add(item);
publisher.Publish(Changed.As<Item>());
}
}
catch
{
}
}
}