From ee997d888f466dad1a673bd9fa2b93e952a78f33 Mon Sep 17 00:00:00 2001 From: TheXamlGuy Date: Sun, 16 Jun 2024 15:48:53 +0100 Subject: [PATCH] More renaming --- Wallet.Avalonia/AllNavigationView.axaml | 4 +-- Wallet.Avalonia/ArchiveNavigationView.axaml | 4 +-- Wallet.Avalonia/CreateWalletView.axaml | 28 ++++++++++++++----- Wallet.Avalonia/OpenWalletView.axaml | 4 +-- Wallet.Avalonia/WalletNavigationView.axaml | 4 +-- Wallet/CreateItemViewModelHandler.cs | 2 +- Wallet/CreateWalletViewModel.cs | 10 +++++-- Wallet/MaskedTextEntryViewModelHandler.cs | 2 +- Wallet/MultilineTextEntryViewModelHandler.cs | 2 +- Wallet/PasswordEntryViewModelHandler.cs | 2 +- Wallet/PinEntryViewModelHandler.cs | 2 +- ...izeCategoriesNavigationViewModelHandler.cs | 2 +- ...SynchronizeItemCategoryViewModelHandler.cs | 2 +- ...nchronizeItemCollectionViewModelHandler.cs | 2 +- ...ItemContentFromCategoryViewModelHandler.cs | 2 +- .../SynchronizeItemContentViewModelHandler.cs | 2 +- Wallet/SynchronizeMainViewModelHandler.cs | 2 +- Wallet/TextEntryViewModelHandler.cs | 2 +- Wallet/WalletActivatedHandler.cs | 2 +- Wallet/WalletInitializer.cs | 5 ++-- 20 files changed, 53 insertions(+), 32 deletions(-) diff --git a/Wallet.Avalonia/AllNavigationView.axaml b/Wallet.Avalonia/AllNavigationView.axaml index 5ec18e3..0695386 100644 --- a/Wallet.Avalonia/AllNavigationView.axaml +++ b/Wallet.Avalonia/AllNavigationView.axaml @@ -11,7 +11,7 @@ - + @@ -21,7 +21,7 @@ - + diff --git a/Wallet.Avalonia/ArchiveNavigationView.axaml b/Wallet.Avalonia/ArchiveNavigationView.axaml index 6a0a757..5e5bab7 100644 --- a/Wallet.Avalonia/ArchiveNavigationView.axaml +++ b/Wallet.Avalonia/ArchiveNavigationView.axaml @@ -11,7 +11,7 @@ - + @@ -21,7 +21,7 @@ - + diff --git a/Wallet.Avalonia/CreateWalletView.axaml b/Wallet.Avalonia/CreateWalletView.axaml index c1a5fd9..579066e 100644 --- a/Wallet.Avalonia/CreateWalletView.axaml +++ b/Wallet.Avalonia/CreateWalletView.axaml @@ -29,17 +29,31 @@ - - + + + + + + + + + - - + + + + + + + + + @@ -58,7 +72,7 @@ Height="48" HorizontalAlignment="Center" VerticalAlignment="Center" - IsActive="{Binding Active}" - IsVisible="{Binding Active}" /> + IsActive="{Binding IsActive}" + IsVisible="{Binding IsActive}" /> diff --git a/Wallet.Avalonia/OpenWalletView.axaml b/Wallet.Avalonia/OpenWalletView.axaml index e03d74d..ba6b593 100644 --- a/Wallet.Avalonia/OpenWalletView.axaml +++ b/Wallet.Avalonia/OpenWalletView.axaml @@ -7,7 +7,7 @@ + IsActive="{Binding IsActive}" /> diff --git a/Wallet.Avalonia/WalletNavigationView.axaml b/Wallet.Avalonia/WalletNavigationView.axaml index 1180e05..2deef15 100644 --- a/Wallet.Avalonia/WalletNavigationView.axaml +++ b/Wallet.Avalonia/WalletNavigationView.axaml @@ -59,7 +59,7 @@ - + @@ -81,7 +81,7 @@ - + diff --git a/Wallet/CreateItemViewModelHandler.cs b/Wallet/CreateItemViewModelHandler.cs index 7ba9ec3..2bb7080 100644 --- a/Wallet/CreateItemViewModelHandler.cs +++ b/Wallet/CreateItemViewModelHandler.cs @@ -29,7 +29,7 @@ public class CreateItemViewModelHandler(IServiceFactory serviceFactory, itemHeaderConfigurationDecorator.Set(configuration); - if (serviceFactory.Create(args => args.Initialize(), args.Parameters) is ItemViewModel itemViewModel) + if (serviceFactory.Create(args => args.OnInitialize(), args.Parameters) is ItemViewModel itemViewModel) { itemViewModel.Add(configuration, state, "", name); itemViewModel.Add(); diff --git a/Wallet/CreateWalletViewModel.cs b/Wallet/CreateWalletViewModel.cs index 571e800..4a8babe 100644 --- a/Wallet/CreateWalletViewModel.cs +++ b/Wallet/CreateWalletViewModel.cs @@ -5,7 +5,8 @@ using Toolkit.Foundation; namespace Wallet; -public partial class CreateWalletViewModel : Observable, +public partial class CreateWalletViewModel : + Observable, IPrimaryConfirmation { [MaybeNull] @@ -23,6 +24,9 @@ public partial class CreateWalletViewModel : Observable, [ObservableProperty] private IValidation validation; + [ObservableProperty] + private bool isConfirmed; + public CreateWalletViewModel(IValidation validation, IServiceProvider provider, IServiceFactory factory, @@ -46,8 +50,10 @@ public partial class CreateWalletViewModel : Observable, { using (await new ActivityLock(this)) { - return await Mediator.Handle>, + IsConfirmed = await Mediator.Handle>, bool>(Create.As(new Wallet<(string, string)>((Name, Password)))); + + return IsConfirmed; } } diff --git a/Wallet/MaskedTextEntryViewModelHandler.cs b/Wallet/MaskedTextEntryViewModelHandler.cs index 49c783b..0a13524 100644 --- a/Wallet/MaskedTextEntryViewModelHandler.cs +++ b/Wallet/MaskedTextEntryViewModelHandler.cs @@ -14,7 +14,7 @@ public class MaskedTextEntryViewModelHandler(IServiceFactory serviceFactory) : string? value = $"{configuration.Value}" ?? ""; double? width = configuration.Width; - if (serviceFactory.Create(args => args.Initialize(), + if (serviceFactory.Create(args => args.OnInitialize(), [.. args.Parameters, configuration, configuration.Pattern, label, value, width]) is MaskedTextEntryViewModel viewModel) { diff --git a/Wallet/MultilineTextEntryViewModelHandler.cs b/Wallet/MultilineTextEntryViewModelHandler.cs index 6817d76..862b83b 100644 --- a/Wallet/MultilineTextEntryViewModelHandler.cs +++ b/Wallet/MultilineTextEntryViewModelHandler.cs @@ -14,7 +14,7 @@ public class MultilineTextEntryViewModelHandler(IServiceFactory serviceFactory) string? value = $"{configuration.Value}" ?? ""; double? width = configuration.Width; - if (serviceFactory.Create(args => args.Initialize(), + if (serviceFactory.Create(args => args.OnInitialize(), [.. args.Parameters, configuration, label, value, width]) is MultilineTextEntryViewModel viewModel) { diff --git a/Wallet/PasswordEntryViewModelHandler.cs b/Wallet/PasswordEntryViewModelHandler.cs index 324b64d..a6da90c 100644 --- a/Wallet/PasswordEntryViewModelHandler.cs +++ b/Wallet/PasswordEntryViewModelHandler.cs @@ -14,7 +14,7 @@ public class PasswordEntryViewModelHandler(IServiceFactory serviceFactory) : string? value = $"{configuration.Value}" ?? ""; double? width = configuration.Width; - if (serviceFactory.Create(args => args.Initialize(), + if (serviceFactory.Create(args => args.OnInitialize(), [.. args.Parameters, configuration, label, value, width]) is PasswordEntryViewModel viewModel) { diff --git a/Wallet/PinEntryViewModelHandler.cs b/Wallet/PinEntryViewModelHandler.cs index 612350b..e57d06b 100644 --- a/Wallet/PinEntryViewModelHandler.cs +++ b/Wallet/PinEntryViewModelHandler.cs @@ -14,7 +14,7 @@ public class PinEntryViewModelHandler(IServiceFactory serviceFactory) : string? value = $"{configuration.Value}" ?? ""; double? width = configuration.Width; - if (serviceFactory.Create(args => args.Initialize(), + if (serviceFactory.Create(args => args.OnInitialize(), [.. args.Parameters, configuration, label, value, width]) is PinEntryViewModel viewModel) { diff --git a/Wallet/SynchronizeCategoriesNavigationViewModelHandler.cs b/Wallet/SynchronizeCategoriesNavigationViewModelHandler.cs index af351c7..a21182b 100644 --- a/Wallet/SynchronizeCategoriesNavigationViewModelHandler.cs +++ b/Wallet/SynchronizeCategoriesNavigationViewModelHandler.cs @@ -18,7 +18,7 @@ public class SynchronizeCategoriesNavigationViewModelHandler(IMediator mediator, int count = counts?.FirstOrDefault(x => x.Name == configuration.Key).Count ?? 0; string name = configuration.Key; - if (serviceFactory.Create(args => args.Initialize(), count, name) + if (serviceFactory.Create(args => args.OnInitialize(), count, name) is CategoryNavigationViewModel viewModel) { publisher.Publish(Create.As(viewModel), nameof(CategoriesNavigationViewModel)); diff --git a/Wallet/SynchronizeItemCategoryViewModelHandler.cs b/Wallet/SynchronizeItemCategoryViewModelHandler.cs index 088664d..3db98fb 100644 --- a/Wallet/SynchronizeItemCategoryViewModelHandler.cs +++ b/Wallet/SynchronizeItemCategoryViewModelHandler.cs @@ -12,7 +12,7 @@ public class SynchronizeItemCategoryViewModelHandler(IItemConfigurationCollectio bool selected = true; foreach (KeyValuePair> configuration in configurations) { - if (serviceFactory.Create(args => args.Initialize(), + if (serviceFactory.Create(args => args.OnInitialize(), configuration.Key, selected) is ItemCategoryNavigationViewModel viewModel) { diff --git a/Wallet/SynchronizeItemCollectionViewModelHandler.cs b/Wallet/SynchronizeItemCollectionViewModelHandler.cs index bb53f02..25857b0 100644 --- a/Wallet/SynchronizeItemCollectionViewModelHandler.cs +++ b/Wallet/SynchronizeItemCollectionViewModelHandler.cs @@ -31,7 +31,7 @@ public class SynchronizeItemCollectionViewModelHandler(IMediator mediator, IDecoratorService> decoratorService = serviceScope.ServiceProvider .GetRequiredService>>(); - if (serviceFactory.Create(args => args.Initialize(), + if (serviceFactory.Create(args => args.OnInitialize(), Id, Name, "Description", Category, selected, Favourite, Archived) is ItemNavigationViewModel viewModel) { diff --git a/Wallet/SynchronizeItemContentFromCategoryViewModelHandler.cs b/Wallet/SynchronizeItemContentFromCategoryViewModelHandler.cs index 49bc4bf..6dcc72e 100644 --- a/Wallet/SynchronizeItemContentFromCategoryViewModelHandler.cs +++ b/Wallet/SynchronizeItemContentFromCategoryViewModelHandler.cs @@ -22,7 +22,7 @@ public class SynchronizeItemContentFromCategoryViewModelHandler(IItemConfigurati foreach (ItemSectionConfiguration configurationSection in configuration.Sections) { string id = $"{nameof(ItemSection)}:{Guid.NewGuid()}"; - if (serviceFactory.Create(args => args.Initialize(), id) + if (serviceFactory.Create(args => args.OnInitialize(), id) is ItemSectionViewModel sectionViewModel) { publisher.Publish(Create.As(sectionViewModel), nameof(ItemContentViewModel)); diff --git a/Wallet/SynchronizeItemContentViewModelHandler.cs b/Wallet/SynchronizeItemContentViewModelHandler.cs index b057605..dd682b5 100644 --- a/Wallet/SynchronizeItemContentViewModelHandler.cs +++ b/Wallet/SynchronizeItemContentViewModelHandler.cs @@ -25,7 +25,7 @@ public class SynchronizeItemContentViewModelHandler(IDecoratorService(args => args.Initialize(), id) + if (serviceFactory.Create(args => args.OnInitialize(), id) is ItemSectionViewModel sectionViewModel) { publisher.Publish(Create.As(sectionViewModel), nameof(ItemContentViewModel)); diff --git a/Wallet/SynchronizeMainViewModelHandler.cs b/Wallet/SynchronizeMainViewModelHandler.cs index 4fcc87f..80f98cd 100644 --- a/Wallet/SynchronizeMainViewModelHandler.cs +++ b/Wallet/SynchronizeMainViewModelHandler.cs @@ -19,7 +19,7 @@ public class SynchronizeMainViewModelHandler(IPublisher publisher, { if (Wallet.Services.GetRequiredService() is IServiceFactory factory) { - if (factory.Create(args => args.Initialize(), descriptor.Name, selected) + if (factory.Create(args => args.OnInitialize(), descriptor.Name, selected) is WalletNavigationViewModel viewModel) { publisher.Publish(Create.As(viewModel), diff --git a/Wallet/TextEntryViewModelHandler.cs b/Wallet/TextEntryViewModelHandler.cs index 2eb8731..6f76994 100644 --- a/Wallet/TextEntryViewModelHandler.cs +++ b/Wallet/TextEntryViewModelHandler.cs @@ -14,7 +14,7 @@ public class TextEntryViewModelHandler(IServiceFactory serviceFactory) : string? value = $"{configuration.Value}" ?? ""; double? width = configuration.Width; - if (serviceFactory.Create(args => args.Initialize(), + if (serviceFactory.Create(args => args.OnInitialize(), [.. args.Parameters, configuration, label, value, width]) is TextEntryViewModel viewModel) { diff --git a/Wallet/WalletActivatedHandler.cs b/Wallet/WalletActivatedHandler.cs index 91993bf..5292e15 100644 --- a/Wallet/WalletActivatedHandler.cs +++ b/Wallet/WalletActivatedHandler.cs @@ -22,7 +22,7 @@ public class WalletActivatedHandler(IWalletHostCollection Wallets, { if (host.Services.GetRequiredService() is IServiceFactory serviceFactory) { - if (serviceFactory.Create(args => args.Initialize(), + if (serviceFactory.Create(args => args.OnInitialize(), descriptor.Name, false) is WalletNavigationViewModel viewModel) { diff --git a/Wallet/WalletInitializer.cs b/Wallet/WalletInitializer.cs index 3caca66..ca25df2 100644 --- a/Wallet/WalletInitializer.cs +++ b/Wallet/WalletInitializer.cs @@ -4,9 +4,10 @@ namespace Wallet; public class WalletInitializer(IEnumerable> configurations, IComponentFactory componentFactory, - IWalletHostCollection Wallets) : IInitialization + IWalletHostCollection Wallets) : + IInitialization { - public async Task Initialize() + public async Task OnInitialize() { foreach (IConfigurationDescriptor configuration in configurations) {