using CommunityToolkit.Mvvm.Input; using Toolkit.Foundation; namespace Wallet; public partial class AttachmentEntryCollectionViewModel(IServiceProvider provider, IServiceFactory factory, IMediator mediator, IPublisher publisher, ISubscriber subscriber, IDisposer disposer, IContentTemplate template, ItemState state, IItemEntryConfiguration> configuration, string key, ICollection value, bool isConcealed, bool isRevealed, double width) : ItemEntryCollectionViewModel>(provider, factory, mediator, publisher, subscriber, disposer, state, configuration, key, value, isConcealed, isRevealed, width) { public IContentTemplate Template { get; set; } = template; [RelayCommand] private async Task Invoke() { if (await Mediator.Handle, IReadOnlyCollection>(Create.As()) is IReadOnlyCollection fileDescriptors) { foreach (IFileDescriptor file in fileDescriptors) { string path = file.Path; DateTimeOffset created = DateTimeOffset.Now; string name = file.Name; long size = file.Size; Attachment attachment = new() { Name = name, Path = path, DateTime = created }; Add(path, created, size, name); Value.Add(attachment); } } } }