This commit is contained in:
TheXamlGuy
2024-07-13 21:35:58 +01:00
parent 3b4deea573
commit f4f9fdac46
32 changed files with 369 additions and 235 deletions
@@ -0,0 +1,30 @@
using Toolkit.Foundation;
namespace Wallet;
public class CommentEntryCollectionViewModelHandler(IServiceFactory serviceFactory) :
IHandler<CreateEventArgs<CommentEntryCollectionConfiguration>, IItemEntryViewModel?>
{
public Task<IItemEntryViewModel?> Handle(CreateEventArgs<CommentEntryCollectionConfiguration> args,
CancellationToken cancellationToken)
{
if (args.Sender is CommentEntryCollectionConfiguration configuration)
{
string? label = configuration.Label;
string? value = $"{configuration.Value}" ?? "";
double? width = configuration.Width;
if (serviceFactory.Create<CommentEntryCollectionViewModel>(args => args.Initialize(),
[.. args.Parameters, configuration, label, value, false, false, width])
is CommentEntryCollectionViewModel viewModel)
{
viewModel.Add<CreateCommentEntryViewModel>();
return Task.FromResult<IItemEntryViewModel?>(viewModel);
}
}
return Task.FromResult<IItemEntryViewModel?>(default);
}
}