Mass rename project for rebranding

This commit is contained in:
TheXamlGuy
2024-06-09 14:00:36 +01:00
parent 1f777e19cd
commit 45712d0a70
241 changed files with 310 additions and 366 deletions
+35
View File
@@ -0,0 +1,35 @@
using Microsoft.Extensions.DependencyInjection;
using Toolkit.Foundation;
namespace Wallet;
public class WalletActivatedHandler(IWalletHostCollection Wallets,
IPublisher publisher) :
INotificationHandler<ActivatedEventArgs<IComponentHost>>
{
public Task Handle(ActivatedEventArgs<IComponentHost> args)
{
if (args.Value is IComponentHost Wallet)
{
List<IComponentHost> sortedWallets = [.. Wallets, Wallet];
sortedWallets = [.. sortedWallets.OrderBy(x => x.Services.GetRequiredService<IConfigurationDescriptor<WalletConfiguration>>() is
IConfigurationDescriptor<WalletConfiguration> descriptor ? descriptor.Name : null)];
int index = sortedWallets.IndexOf(Wallet);
if (Wallet.Services.GetRequiredService<ConfigurationDescriptor<WalletConfiguration>>() is ConfigurationDescriptor<WalletConfiguration> descriptor)
{
if (Wallet.Services.GetRequiredService<IServiceFactory>() is IServiceFactory serviceFactory)
{
if (serviceFactory.Create<WalletNavigationViewModel>(descriptor.Name) is WalletNavigationViewModel viewModel)
{
publisher.Publish(new InsertEventArgs<IMainNavigationViewModel>(index, viewModel),
nameof(MainViewModel));
}
}
}
}
return Task.CompletedTask;
}
}