Add contextual commands
This commit is contained in:
@@ -2,24 +2,30 @@
|
||||
|
||||
namespace Bitvault;
|
||||
|
||||
public partial class ItemCommandHeaderViewModel : ObservableCollection
|
||||
public partial class ItemCommandHeaderViewModel(IServiceProvider provider,
|
||||
IServiceFactory factory,
|
||||
IMediator mediator,
|
||||
IPublisher publisher,
|
||||
ISubscription subscriber,
|
||||
IDisposer disposer,
|
||||
IContentTemplate template) :
|
||||
ObservableCollection(provider, factory, mediator, publisher, subscriber, disposer),
|
||||
INotificationHandler<NotifyEventArgs<CommandCollection>>
|
||||
{
|
||||
public ItemCommandHeaderViewModel(IServiceProvider provider,
|
||||
IServiceFactory factory,
|
||||
IMediator mediator,
|
||||
IPublisher publisher,
|
||||
ISubscription subscriber,
|
||||
IDisposer disposer,
|
||||
IContentTemplate template) : base(provider, factory, mediator, publisher, subscriber, disposer)
|
||||
public IContentTemplate Template { get; set; } = template;
|
||||
|
||||
public Task Handle(NotifyEventArgs<CommandCollection> args)
|
||||
{
|
||||
Add<ConfirmItemActionViewModel>();
|
||||
Add<DismissItemActionViewModel>();
|
||||
Add<EditItemActionViewModel>();
|
||||
Add<DeleteItemActionViewModel>();
|
||||
Add<ArchiveItemActionViewModel>();
|
||||
Clear();
|
||||
|
||||
Template = template;
|
||||
if (args.Value is CommandCollection commandCollection)
|
||||
{
|
||||
foreach (IDisposable command in commandCollection)
|
||||
{
|
||||
Add(command);
|
||||
}
|
||||
}
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public IContentTemplate Template { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user