Mass rename to align planned codename
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Toolkit.Foundation;
|
||||
|
||||
namespace Bitvault;
|
||||
|
||||
public class LockerActivatedHandler(ILockerHostCollection lockers,
|
||||
IPublisher publisher) :
|
||||
INotificationHandler<ActivatedEventArgs<IComponentHost>>
|
||||
{
|
||||
public Task Handle(ActivatedEventArgs<IComponentHost> args)
|
||||
{
|
||||
if (args.Value is IComponentHost locker)
|
||||
{
|
||||
List<IComponentHost> sortedLockers = [.. lockers, locker];
|
||||
sortedLockers = [.. sortedLockers.OrderBy(x => x.GetConfiguration<LockerConfiguration>() is LockerConfiguration configuration ? configuration.Name : null)];
|
||||
|
||||
int index = sortedLockers.IndexOf(locker);
|
||||
|
||||
if (locker.Services.GetRequiredService<LockerConfiguration>() is LockerConfiguration configuration)
|
||||
{
|
||||
if (locker.Services.GetRequiredService<IServiceFactory>() is IServiceFactory serviceFactory)
|
||||
{
|
||||
if (serviceFactory.Create<LockerNavigationViewModel>(configuration.Name) is LockerNavigationViewModel viewModel)
|
||||
{
|
||||
publisher.Publish(new InsertEventArgs<IMainNavigationViewModel>(index, viewModel),
|
||||
nameof(MainViewModel));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user