Some refactoring
This commit is contained in:
@@ -24,7 +24,7 @@
|
|||||||
<ComparisonCondition LeftOperand="{Binding Activated}" RightOperand="True" />
|
<ComparisonCondition LeftOperand="{Binding Activated}" RightOperand="True" />
|
||||||
</ConditionalExpression>
|
</ConditionalExpression>
|
||||||
</ConditionAction.Condition>
|
</ConditionAction.Condition>
|
||||||
<NavigateAction Region="Left" Route="ContentItemCollection">
|
<NavigateAction Region="Left" Route="ItemCollection">
|
||||||
<Parameter Key="Filter" Value="{Binding Filter}" />
|
<Parameter Key="Filter" Value="{Binding Filter}" />
|
||||||
<Parameter Key="Transition" Value="FromRight" />
|
<Parameter Key="Transition" Value="FromRight" />
|
||||||
<Parameter Key="NavigationStackEnabled" Value="{x:True}" />
|
<Parameter Key="NavigationStackEnabled" Value="{x:True}" />
|
||||||
|
|||||||
@@ -120,12 +120,12 @@ public partial class App : Application
|
|||||||
|
|
||||||
services.AddTemplate<OpenWalletViewModel, OpenWalletView>("OpenWallet");
|
services.AddTemplate<OpenWalletViewModel, OpenWalletView>("OpenWallet");
|
||||||
|
|
||||||
services.AddScoped<WalletViewModelConfiguration>();
|
services.AddScoped<ItemCollectionConfiguration>();
|
||||||
|
|
||||||
services.AddTemplate<WalletViewModel, WalletView>("Wallet");
|
services.AddTemplate<WalletViewModel, WalletView>("Wallet");
|
||||||
services.AddTemplate<ItemCollectionViewModel, ItemCollectionView>("ContentItemCollection");
|
services.AddTemplate<ItemCollectionViewModel, ItemCollectionView>("ItemCollection");
|
||||||
|
|
||||||
services.AddHandler<SynchronizeItemViewModelHandler>();
|
services.AddHandler<SynchronizeItemCollectionViewModelHandler>();
|
||||||
|
|
||||||
services.AddTemplate<WalletHeaderViewModel, WalletHeaderView>("WalletHeader");
|
services.AddTemplate<WalletHeaderViewModel, WalletHeaderView>("WalletHeader");
|
||||||
services.AddTemplate<BackActionViewModel, BackActionView>();
|
services.AddTemplate<BackActionViewModel, BackActionView>();
|
||||||
@@ -146,9 +146,12 @@ public partial class App : Application
|
|||||||
services.AddTemplate<ItemNavigationViewModel, ItemNavigationView>();
|
services.AddTemplate<ItemNavigationViewModel, ItemNavigationView>();
|
||||||
services.AddTemplate<EmptyItemCollectionViewModel, EmptyItemCollectionView>("EmptyItemCollection");
|
services.AddTemplate<EmptyItemCollectionViewModel, EmptyItemCollectionView>("EmptyItemCollection");
|
||||||
|
|
||||||
|
services.AddScoped<IDecoratorService<ItemHeaderConfiguration>, DecoratorService<ItemHeaderConfiguration>>();
|
||||||
services.AddScoped<IDecoratorService<ItemConfiguration>, DecoratorService<ItemConfiguration>>();
|
services.AddScoped<IDecoratorService<ItemConfiguration>, DecoratorService<ItemConfiguration>>();
|
||||||
|
|
||||||
services.AddTemplate<ItemViewModel, ItemView>("Item");
|
services.AddTemplate<ItemViewModel, ItemView>("Item");
|
||||||
|
services.AddHandler<CreateItemViewModelHandler>("Item");
|
||||||
|
|
||||||
services.AddTemplate<ItemHeaderViewModel, ItemHeaderView>();
|
services.AddTemplate<ItemHeaderViewModel, ItemHeaderView>();
|
||||||
services.AddTemplate<ItemContentViewModel, ItemContentView>();
|
services.AddTemplate<ItemContentViewModel, ItemContentView>();
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
<ComparisonCondition LeftOperand="{Binding Activated}" RightOperand="True" />
|
<ComparisonCondition LeftOperand="{Binding Activated}" RightOperand="True" />
|
||||||
</ConditionalExpression>
|
</ConditionalExpression>
|
||||||
</ConditionAction.Condition>
|
</ConditionAction.Condition>
|
||||||
<NavigateAction Region="Left" Route="ContentItemCollection">
|
<NavigateAction Region="Left" Route="ItemCollection">
|
||||||
<Parameter Key="Filter" Value="{Binding Filter}" />
|
<Parameter Key="Filter" Value="{Binding Filter}" />
|
||||||
<Parameter Key="Transition" Value="FromRight" />
|
<Parameter Key="Transition" Value="FromRight" />
|
||||||
<Parameter Key="NavigationStackEnabled" Value="{x:True}" />
|
<Parameter Key="NavigationStackEnabled" Value="{x:True}" />
|
||||||
|
|||||||
@@ -5,4 +5,5 @@
|
|||||||
xmlns:vm="using:Wallet"
|
xmlns:vm="using:Wallet"
|
||||||
x:DataType="vm:CategoriesNavigationViewModel"
|
x:DataType="vm:CategoriesNavigationViewModel"
|
||||||
Content="Categories"
|
Content="Categories"
|
||||||
MenuItemsSource="{Binding}" />
|
MenuItemsSource="{Binding}"
|
||||||
|
SelectsOnInvoked="False" />
|
||||||
|
|||||||
@@ -4,4 +4,32 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:vm="using:Wallet"
|
xmlns:vm="using:Wallet"
|
||||||
x:DataType="vm:CategoryNavigationViewModel"
|
x:DataType="vm:CategoryNavigationViewModel"
|
||||||
Content="{Binding Filter}" />
|
Content="{Binding Filter}"
|
||||||
|
IsSelected="{Binding Selected}">
|
||||||
|
<Interaction.Behaviors>
|
||||||
|
<DataTriggerBehavior Binding="{Binding Selected}" Value="True">
|
||||||
|
<ConditionAction>
|
||||||
|
<ConditionAction.Condition>
|
||||||
|
<ConditionalExpression ForwardChaining="And">
|
||||||
|
<ComparisonCondition LeftOperand="{Binding Activated}" RightOperand="False" />
|
||||||
|
</ConditionalExpression>
|
||||||
|
</ConditionAction.Condition>
|
||||||
|
<NavigateAction Region="Main" Route="Wallet">
|
||||||
|
<Parameter Key="Filter" Value="{Binding Filter}" />
|
||||||
|
</NavigateAction>
|
||||||
|
</ConditionAction>
|
||||||
|
<ConditionAction>
|
||||||
|
<ConditionAction.Condition>
|
||||||
|
<ConditionalExpression ForwardChaining="And">
|
||||||
|
<ComparisonCondition LeftOperand="{Binding Activated}" RightOperand="True" />
|
||||||
|
</ConditionalExpression>
|
||||||
|
</ConditionAction.Condition>
|
||||||
|
<NavigateAction Region="Left" Route="ItemCollection">
|
||||||
|
<Parameter Key="Filter" Value="{Binding Filter}" />
|
||||||
|
<Parameter Key="Transition" Value="FromRight" />
|
||||||
|
<Parameter Key="NavigationStackEnabled" Value="{x:True}" />
|
||||||
|
</NavigateAction>
|
||||||
|
</ConditionAction>
|
||||||
|
</DataTriggerBehavior>
|
||||||
|
</Interaction.Behaviors>
|
||||||
|
</NavigationViewItem>
|
||||||
|
|||||||
@@ -14,11 +14,11 @@
|
|||||||
Region="{Binding Named, StringFormat='{}{0}:Content'}"
|
Region="{Binding Named, StringFormat='{}{0}:Content'}"
|
||||||
Route="Item"
|
Route="Item"
|
||||||
Scope="self">
|
Scope="self">
|
||||||
<Parameter Key="FromCategory" Value="{x:False}" />
|
|
||||||
<Parameter Key="State" Value="{x:Static vm:ItemState.Read}" />
|
|
||||||
<Parameter Key="Name" Value="{Binding Name}" />
|
<Parameter Key="Name" Value="{Binding Name}" />
|
||||||
|
<Parameter Key="FromCategory" Value="{x:False}" />
|
||||||
<Parameter Key="Favourite" Value="{Binding Favourite}" />
|
<Parameter Key="Favourite" Value="{Binding Favourite}" />
|
||||||
<Parameter Key="Archived" Value="{Binding Archived}" />
|
<Parameter Key="Archived" Value="{Binding Archived}" />
|
||||||
|
<Parameter Key="State" Value="{x:Static vm:ItemState.Read}" />
|
||||||
<Parameter Key="NavigationStackEnabled" Value="{x:False}" />
|
<Parameter Key="NavigationStackEnabled" Value="{x:False}" />
|
||||||
</NavigateAction>
|
</NavigateAction>
|
||||||
</AttachedEventTriggerBehaviour>
|
</AttachedEventTriggerBehaviour>
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
<ComparisonCondition LeftOperand="{Binding Activated}" RightOperand="True" />
|
<ComparisonCondition LeftOperand="{Binding Activated}" RightOperand="True" />
|
||||||
</ConditionalExpression>
|
</ConditionalExpression>
|
||||||
</ConditionAction.Condition>
|
</ConditionAction.Condition>
|
||||||
<NavigateAction Region="Left" Route="ContentItemCollection">
|
<NavigateAction Region="Left" Route="ItemCollection">
|
||||||
<Parameter Key="Filter" Value="{Binding Filter}" />
|
<Parameter Key="Filter" Value="{Binding Filter}" />
|
||||||
<Parameter Key="Transition" Value="FromRight" />
|
<Parameter Key="Transition" Value="FromRight" />
|
||||||
<Parameter Key="NavigationStackEnabled" Value="{x:True}" />
|
<Parameter Key="NavigationStackEnabled" Value="{x:True}" />
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
<Interaction.Behaviors>
|
<Interaction.Behaviors>
|
||||||
<AttachedBehaviour>
|
<AttachedBehaviour>
|
||||||
<NavigateRegionAction Name="Left">
|
<NavigateRegionAction Name="Left">
|
||||||
<NavigateAction Region="Left" Route="ContentItemCollection">
|
<NavigateAction Region="Left" Route="ItemCollection">
|
||||||
<Parameter Key="Filter" Value="{Binding Filter}" />
|
<Parameter Key="Filter" Value="{Binding Filter}" />
|
||||||
</NavigateAction>
|
</NavigateAction>
|
||||||
</NavigateRegionAction>
|
</NavigateRegionAction>
|
||||||
|
|||||||
@@ -4,21 +4,24 @@ namespace Wallet;
|
|||||||
|
|
||||||
public class ConfirmCreateItemHandler(IMediator mediator,
|
public class ConfirmCreateItemHandler(IMediator mediator,
|
||||||
IDecoratorService<ItemConfiguration> itemConfigurationDecorator,
|
IDecoratorService<ItemConfiguration> itemConfigurationDecorator,
|
||||||
|
IDecoratorService<ItemHeaderConfiguration> itemHeaderConfiguration,
|
||||||
IPublisher publisher) :
|
IPublisher publisher) :
|
||||||
INotificationHandler<ConfirmEventArgs<Item>>
|
INotificationHandler<ConfirmEventArgs<Item>>
|
||||||
{
|
{
|
||||||
public async Task Handle(ConfirmEventArgs<Item> args)
|
public async Task Handle(ConfirmEventArgs<Item> args)
|
||||||
{
|
{
|
||||||
if (itemConfigurationDecorator.Service is ItemConfiguration configuration)
|
if (itemHeaderConfiguration.Service is ItemHeaderConfiguration headerConfiguration &&
|
||||||
|
itemConfigurationDecorator.Service is ItemConfiguration itemConfiguration)
|
||||||
{
|
{
|
||||||
string? name = await mediator.Handle<ConfirmEventArgs<ItemHeader>, string>(Confirm.As<ItemHeader>());
|
string? name = headerConfiguration?.Name;
|
||||||
if (name is not null)
|
if (name is not null)
|
||||||
{
|
{
|
||||||
Guid id = Guid.NewGuid();
|
Guid id = Guid.NewGuid();
|
||||||
publisher.Publish(Created.As(new Item<(Guid, string)>((id, name))));
|
publisher.Publish(Created.As(new Item<(Guid, string)>((id, name))));
|
||||||
|
|
||||||
await mediator.Handle<CreateEventArgs<(Guid, string, string,
|
await mediator.Handle<CreateEventArgs<(Guid, string, string,
|
||||||
ItemConfiguration)>, bool>(new CreateEventArgs<(Guid, string, string, ItemConfiguration)>((id, name, "", configuration)));
|
ItemConfiguration)>, bool>(new CreateEventArgs<(Guid, string, string,
|
||||||
|
ItemConfiguration)>((id, name, "", itemConfiguration)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,18 +4,18 @@ namespace Wallet;
|
|||||||
|
|
||||||
public class ConfirmUpdateItemHandler(IDecoratorService<Item<(Guid, string)>> itemDecorator,
|
public class ConfirmUpdateItemHandler(IDecoratorService<Item<(Guid, string)>> itemDecorator,
|
||||||
IDecoratorService<ItemConfiguration> itemConfigurationDecorator,
|
IDecoratorService<ItemConfiguration> itemConfigurationDecorator,
|
||||||
|
IDecoratorService<ItemHeaderConfiguration> itemHeaderConfiguration,
|
||||||
IMediator mediator,
|
IMediator mediator,
|
||||||
IPublisher publisher) :
|
IPublisher publisher) :
|
||||||
INotificationHandler<ConfirmEventArgs<Item>>
|
INotificationHandler<ConfirmEventArgs<Item>>
|
||||||
{
|
{
|
||||||
public async Task Handle(ConfirmEventArgs<Item> args)
|
public async Task Handle(ConfirmEventArgs<Item> args)
|
||||||
{
|
{
|
||||||
if (itemDecorator?.Service is Item<(Guid, string)> item &&
|
if (itemDecorator?.Service is Item<(Guid, string)> item &&
|
||||||
itemConfigurationDecorator.Service is ItemConfiguration configuration)
|
itemHeaderConfiguration.Service is ItemHeaderConfiguration headerConfiguration &&
|
||||||
|
itemConfigurationDecorator.Service is ItemConfiguration itemConfiguration)
|
||||||
{
|
{
|
||||||
string? name = await mediator.Handle<ConfirmEventArgs<ItemHeader>,
|
string? name = headerConfiguration?.Name;
|
||||||
string>(Confirm.As<ItemHeader>());
|
|
||||||
|
|
||||||
if (name is not null)
|
if (name is not null)
|
||||||
{
|
{
|
||||||
publisher.Publish(Notify.As(new ItemHeader<string>(name)));
|
publisher.Publish(Notify.As(new ItemHeader<string>(name)));
|
||||||
@@ -28,7 +28,7 @@ public class ConfirmUpdateItemHandler(IDecoratorService<Item<(Guid, string)>> it
|
|||||||
itemDecorator.Set(newItem);
|
itemDecorator.Set(newItem);
|
||||||
|
|
||||||
await mediator.Handle<UpdateEventArgs<Item<(Guid, string, ItemConfiguration)>>, bool>(new UpdateEventArgs<Item<(Guid, string,
|
await mediator.Handle<UpdateEventArgs<Item<(Guid, string, ItemConfiguration)>>, bool>(new UpdateEventArgs<Item<(Guid, string,
|
||||||
ItemConfiguration)>>(new Item<(Guid, string, ItemConfiguration)>((id, name, configuration))));
|
ItemConfiguration)>>(new Item<(Guid, string, ItemConfiguration)>((id, name, itemConfiguration))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ public class CreateItemHandler(IDbContextFactory<WalletContext> dbContextFactory
|
|||||||
public async Task<bool> Handle(CreateEventArgs<(Guid, string, string, ItemConfiguration)> args,
|
public async Task<bool> Handle(CreateEventArgs<(Guid, string, string, ItemConfiguration)> args,
|
||||||
CancellationToken cancellationToken)
|
CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
if (args.Value is (Guid id, string name, string category, ItemConfiguration configuration))
|
if (args.Sender is (Guid id, string name, string category, ItemConfiguration configuration))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
using System.Xml.Linq;
|
||||||
|
using Toolkit.Foundation;
|
||||||
|
|
||||||
|
namespace Wallet;
|
||||||
|
|
||||||
|
public class CreateItemViewModelHandler(IServiceFactory serviceFactory,
|
||||||
|
IDecoratorService<ItemHeaderConfiguration> itemHeaderConfigurationDecorator) :
|
||||||
|
IHandler<CreateEventArgs<ItemViewModel>, ItemViewModel?>
|
||||||
|
{
|
||||||
|
public Task<ItemViewModel?> Handle(CreateEventArgs<ItemViewModel> args,
|
||||||
|
CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
string? name = "";
|
||||||
|
ItemState? state = null;
|
||||||
|
|
||||||
|
if (args.Parameters is { Length: 5 })
|
||||||
|
{
|
||||||
|
(name, bool _, bool _, bool _, state) = args.Parameters.CreateValueTuple<string, bool, bool, bool, ItemState>();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.Parameters is { Length: 2 })
|
||||||
|
{
|
||||||
|
(bool _, state) = args.Parameters.CreateValueTuple<bool, ItemState>();
|
||||||
|
}
|
||||||
|
|
||||||
|
ItemHeaderConfiguration configuration = new()
|
||||||
|
{
|
||||||
|
Name = name
|
||||||
|
};
|
||||||
|
|
||||||
|
itemHeaderConfigurationDecorator.Set(configuration);
|
||||||
|
|
||||||
|
if (serviceFactory.Create<ItemViewModel>(args.Parameters) is ItemViewModel itemViewModel)
|
||||||
|
{
|
||||||
|
itemViewModel.Add<ItemHeaderViewModel>(configuration, state, "", name);
|
||||||
|
itemViewModel.Add<ItemContentViewModel>();
|
||||||
|
|
||||||
|
return Task.FromResult<ItemViewModel?>(itemViewModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Task.FromResult(default(ItemViewModel));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,7 +12,7 @@ public class CreateWalletHandler(IWalletFactory componentFactory,
|
|||||||
public async Task<bool> Handle(CreateEventArgs<Wallet<(string, string)>> args,
|
public async Task<bool> Handle(CreateEventArgs<Wallet<(string, string)>> args,
|
||||||
CancellationToken cancellationToken)
|
CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
if (args.Value is Wallet <(string, string)> Wallet)
|
if (args.Sender is Wallet <(string, string)> Wallet)
|
||||||
{
|
{
|
||||||
if (Wallet.Value is (string name, string password) &&
|
if (Wallet.Value is (string name, string password) &&
|
||||||
name is { Length: > 0 } &&
|
name is { Length: > 0 } &&
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ public class DateEntryViewModelHandler(IServiceFactory serviceFactory) :
|
|||||||
public Task<IItemEntryViewModel?> Handle(CreateEventArgs<DateEntryConfiguration> args,
|
public Task<IItemEntryViewModel?> Handle(CreateEventArgs<DateEntryConfiguration> args,
|
||||||
CancellationToken cancellationToken)
|
CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
if (args.Value is DateEntryConfiguration configuration)
|
if (args.Sender is DateEntryConfiguration configuration)
|
||||||
{
|
{
|
||||||
string? label = configuration.Label;
|
string? label = configuration.Label;
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ public class DropdownEntryViewModelHandler(IServiceFactory serviceFactory) :
|
|||||||
public Task<IItemEntryViewModel?> Handle(CreateEventArgs<DropdownEntryConfiguration> args,
|
public Task<IItemEntryViewModel?> Handle(CreateEventArgs<DropdownEntryConfiguration> args,
|
||||||
CancellationToken cancellationToken)
|
CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
if (args.Value is DropdownEntryConfiguration configuration)
|
if (args.Sender is DropdownEntryConfiguration configuration)
|
||||||
{
|
{
|
||||||
List<DropdownValueViewModel> values = [];
|
List<DropdownValueViewModel> values = [];
|
||||||
foreach (string item in configuration.Values)
|
foreach (string item in configuration.Values)
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
using CommunityToolkit.Mvvm.Input;
|
|
||||||
using Toolkit.Foundation;
|
using Toolkit.Foundation;
|
||||||
|
|
||||||
namespace Wallet;
|
namespace Wallet;
|
||||||
@@ -35,10 +34,6 @@ public partial class FilterNavigationViewModel :
|
|||||||
|
|
||||||
public Task Handle(ActivatedEventArgs<Wallet> args) =>
|
public Task Handle(ActivatedEventArgs<Wallet> args) =>
|
||||||
Task.FromResult(Activated = true);
|
Task.FromResult(Activated = true);
|
||||||
|
|
||||||
[RelayCommand]
|
|
||||||
public void Invoke() => Publisher.Publish(Notify.As(new Filter(Filter)),
|
|
||||||
nameof(ItemCollectionViewModel));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public partial class FilterNavigationViewModel<TWalletNavigation> :
|
public partial class FilterNavigationViewModel<TWalletNavigation> :
|
||||||
@@ -46,7 +41,8 @@ public partial class FilterNavigationViewModel<TWalletNavigation> :
|
|||||||
IWalletNavigationViewModel,
|
IWalletNavigationViewModel,
|
||||||
INotificationHandler<ActivatedEventArgs<Wallet>>,
|
INotificationHandler<ActivatedEventArgs<Wallet>>,
|
||||||
INotificationHandler<DeactivatedEventArgs<Wallet>>
|
INotificationHandler<DeactivatedEventArgs<Wallet>>
|
||||||
where TWalletNavigation : IWalletNavigationViewModel
|
where TWalletNavigation :
|
||||||
|
IWalletNavigationViewModel
|
||||||
{
|
{
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
private bool activated;
|
private bool activated;
|
||||||
@@ -73,8 +69,4 @@ public partial class FilterNavigationViewModel<TWalletNavigation> :
|
|||||||
|
|
||||||
public Task Handle(ActivatedEventArgs<Wallet> args) =>
|
public Task Handle(ActivatedEventArgs<Wallet> args) =>
|
||||||
Task.FromResult(Activated = true);
|
Task.FromResult(Activated = true);
|
||||||
|
|
||||||
[RelayCommand]
|
|
||||||
public void Invoke() => Publisher.Publish(Notify.As(new Filter(Filter)),
|
|
||||||
nameof(ItemCollectionViewModel));
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
namespace Wallet;
|
||||||
|
|
||||||
|
public interface IItemViewModel :
|
||||||
|
IDisposable
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
namespace Wallet;
|
namespace Wallet;
|
||||||
|
|
||||||
public record WalletViewModelConfiguration
|
public record ItemCollectionConfiguration
|
||||||
{
|
{
|
||||||
public string? Filter { get; set; } = "All";
|
public string? Filter { get; set; } = "All";
|
||||||
|
|
||||||
@@ -16,7 +16,7 @@ public partial class ItemCollectionViewModel :
|
|||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
public string? named;
|
public string? named;
|
||||||
|
|
||||||
private WalletViewModelConfiguration configuration;
|
private ItemCollectionConfiguration configuration;
|
||||||
|
|
||||||
public ItemCollectionViewModel(IServiceProvider provider,
|
public ItemCollectionViewModel(IServiceProvider provider,
|
||||||
IServiceFactory factory,
|
IServiceFactory factory,
|
||||||
@@ -26,7 +26,7 @@ public partial class ItemCollectionViewModel :
|
|||||||
IDisposer disposer,
|
IDisposer disposer,
|
||||||
IContentTemplate template,
|
IContentTemplate template,
|
||||||
NamedComponent named,
|
NamedComponent named,
|
||||||
WalletViewModelConfiguration configuration,
|
ItemCollectionConfiguration configuration,
|
||||||
string? filter = null) : base(provider, factory, mediator, publisher, subscriber, disposer)
|
string? filter = null) : base(provider, factory, mediator, publisher, subscriber, disposer)
|
||||||
{
|
{
|
||||||
Template = template;
|
Template = template;
|
||||||
@@ -39,7 +39,7 @@ public partial class ItemCollectionViewModel :
|
|||||||
|
|
||||||
public Task Handle(NotifyEventArgs<Filter> args)
|
public Task Handle(NotifyEventArgs<Filter> args)
|
||||||
{
|
{
|
||||||
if (args.Value is Filter filter)
|
if (args.Sender is Filter filter)
|
||||||
{
|
{
|
||||||
configuration = configuration with { Filter = filter.Value };
|
configuration = configuration with { Filter = filter.Value };
|
||||||
Fetch(true);
|
Fetch(true);
|
||||||
@@ -50,7 +50,7 @@ public partial class ItemCollectionViewModel :
|
|||||||
|
|
||||||
public Task Handle(NotifyEventArgs<Search<string>> args)
|
public Task Handle(NotifyEventArgs<Search<string>> args)
|
||||||
{
|
{
|
||||||
if (args.Value is Search<string> search)
|
if (args.Sender is Search<string> search)
|
||||||
{
|
{
|
||||||
configuration = configuration with { Query = search.Value };
|
configuration = configuration with { Query = search.Value };
|
||||||
Fetch(true);
|
Fetch(true);
|
||||||
@@ -71,5 +71,5 @@ public partial class ItemCollectionViewModel :
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected override SynchronizeExpression BuildAggregateExpression() =>
|
protected override SynchronizeExpression BuildAggregateExpression() =>
|
||||||
new(Synchronize.As<ItemNavigationViewModel, WalletViewModelConfiguration>(configuration));
|
new(Synchronize.As<ItemNavigationViewModel, ItemCollectionConfiguration>(configuration));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,16 +16,17 @@ public partial class ItemCommandHeaderViewModel(IServiceProvider provider,
|
|||||||
|
|
||||||
public Task Handle(NotifyEventArgs<ItemCommandHeaderCollection> args)
|
public Task Handle(NotifyEventArgs<ItemCommandHeaderCollection> args)
|
||||||
{
|
{
|
||||||
Clear();
|
if (args.Sender is ItemCommandHeaderCollection commandCollection)
|
||||||
|
|
||||||
if (args.Value is ItemCommandHeaderCollection commandCollection)
|
|
||||||
{
|
{
|
||||||
foreach (IDisposable command in commandCollection)
|
Clear(args =>
|
||||||
{
|
{
|
||||||
Add(command);
|
foreach (IDisposable command in commandCollection)
|
||||||
}
|
{
|
||||||
|
args.Add(command);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -11,18 +11,18 @@ public partial class ItemContentViewModel(IServiceProvider provider,
|
|||||||
IContentTemplate template) :
|
IContentTemplate template) :
|
||||||
ObservableCollection<ItemSectionViewModel>(provider, factory, mediator, publisher, subscriber, disposer),
|
ObservableCollection<ItemSectionViewModel>(provider, factory, mediator, publisher, subscriber, disposer),
|
||||||
IItemEntryViewModel,
|
IItemEntryViewModel,
|
||||||
INotificationHandler<NotifyEventArgs<ItemCategory<string>>>
|
INotificationHandler<NotifyEventArgs<ItemCategory<string>>>,
|
||||||
|
IItemViewModel
|
||||||
{
|
{
|
||||||
public IContentTemplate Template { get; set; } = template;
|
public IContentTemplate Template { get; set; } = template;
|
||||||
|
|
||||||
public Task Handle(NotifyEventArgs<ItemCategory<string>> args)
|
public Task Handle(NotifyEventArgs<ItemCategory<string>> args)
|
||||||
{
|
{
|
||||||
if (args.Value is ItemCategory<string> category)
|
if (args.Sender is ItemCategory<string> category
|
||||||
|
&& category.Value is string value)
|
||||||
{
|
{
|
||||||
if (category.Value is string value)
|
Fetch(() => new SynchronizeExpression(new SynchronizeEventArgs<IItemEntryViewModel,
|
||||||
{
|
string>(value)), true);
|
||||||
Fetch(() => new SynchronizeExpression(new SynchronizeEventArgs<IItemEntryViewModel, string>(value)), true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ public class ItemCreatedHandler(IServiceProvider serviceProvider,
|
|||||||
{
|
{
|
||||||
public Task Handle(CreatedEventArgs<Item<(Guid, string)>> args)
|
public Task Handle(CreatedEventArgs<Item<(Guid, string)>> args)
|
||||||
{
|
{
|
||||||
if (args.Value is Item<(Guid, string)> item)
|
if (args.Sender is Item<(Guid, string)> item)
|
||||||
{
|
{
|
||||||
(Guid id, string name) = item.Value;
|
(Guid id, string name) = item.Value;
|
||||||
|
|
||||||
|
|||||||
@@ -2,4 +2,4 @@
|
|||||||
|
|
||||||
public record ItemHeader<TValue>(TValue Value);
|
public record ItemHeader<TValue>(TValue Value);
|
||||||
|
|
||||||
public record ItemHeader;
|
public record ItemHeader;
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
namespace Wallet;
|
||||||
|
|
||||||
|
public class ItemHeaderConfiguration
|
||||||
|
{
|
||||||
|
public string? Name { get; set; }
|
||||||
|
}
|
||||||
@@ -8,10 +8,11 @@ public partial class ItemHeaderViewModel :
|
|||||||
INotificationHandler<UpdateEventArgs<Item>>,
|
INotificationHandler<UpdateEventArgs<Item>>,
|
||||||
INotificationHandler<ConfirmEventArgs<Item>>,
|
INotificationHandler<ConfirmEventArgs<Item>>,
|
||||||
INotificationHandler<CancelEventArgs<Item>>,
|
INotificationHandler<CancelEventArgs<Item>>,
|
||||||
IHandler<ValidationEventArgs<ItemHeader>, bool>,
|
INotificationHandler<NotifyEventArgs<ItemCategory<string>>>,
|
||||||
IHandler<ConfirmEventArgs<ItemHeader>, string?>,
|
IItemViewModel
|
||||||
INotificationHandler<NotifyEventArgs<ItemCategory<string>>>
|
|
||||||
{
|
{
|
||||||
|
private readonly ItemHeaderConfiguration configuration;
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
private string? category;
|
private string? category;
|
||||||
|
|
||||||
@@ -24,22 +25,19 @@ public partial class ItemHeaderViewModel :
|
|||||||
IPublisher publisher,
|
IPublisher publisher,
|
||||||
ISubscription subscriber,
|
ISubscription subscriber,
|
||||||
IDisposer disposer,
|
IDisposer disposer,
|
||||||
|
ItemHeaderConfiguration configuration,
|
||||||
ItemState state,
|
ItemState state,
|
||||||
string key,
|
string key,
|
||||||
string value) : base(provider, factory, mediator, publisher, subscriber, disposer, key, value)
|
string value) : base(provider, factory, mediator, publisher, subscriber, disposer, key, value)
|
||||||
{
|
{
|
||||||
|
this.configuration = configuration;
|
||||||
|
|
||||||
State = state;
|
State = state;
|
||||||
Value = value;
|
Value = value;
|
||||||
|
|
||||||
Track(nameof(Value), () => Value, newValue => Value = newValue);
|
Track(nameof(Value), () => Value, newValue => Value = newValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<bool> Handle(ValidationEventArgs<ItemHeader> args,
|
|
||||||
CancellationToken cancellationToken)
|
|
||||||
{
|
|
||||||
return Task.FromResult(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Task Handle(UpdateEventArgs<Item> args) =>
|
public Task Handle(UpdateEventArgs<Item> args) =>
|
||||||
Task.FromResult(State = ItemState.Write);
|
Task.FromResult(State = ItemState.Write);
|
||||||
|
|
||||||
@@ -51,6 +49,14 @@ public partial class ItemHeaderViewModel :
|
|||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void OnValueChanged()
|
||||||
|
{
|
||||||
|
if (configuration is not null)
|
||||||
|
{
|
||||||
|
configuration.Name = Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Task Handle(ConfirmEventArgs<Item> args)
|
public Task Handle(ConfirmEventArgs<Item> args)
|
||||||
{
|
{
|
||||||
Commit();
|
Commit();
|
||||||
@@ -61,14 +67,11 @@ public partial class ItemHeaderViewModel :
|
|||||||
|
|
||||||
public Task Handle(NotifyEventArgs<ItemCategory<string>> args)
|
public Task Handle(NotifyEventArgs<ItemCategory<string>> args)
|
||||||
{
|
{
|
||||||
if (args.Value is ItemCategory<string> category)
|
if (args.Sender is ItemCategory<string> category)
|
||||||
{
|
{
|
||||||
Category = category.Value;
|
Category = category.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<string> Handle(ConfirmEventArgs<ItemHeader> args,
|
|
||||||
CancellationToken cancellationToken) => Task.FromResult(Value);
|
|
||||||
}
|
}
|
||||||
@@ -68,7 +68,7 @@ public partial class ItemNavigationViewModel(IServiceProvider provider,
|
|||||||
|
|
||||||
public Task Handle(NotifyEventArgs<ItemHeader<string>> args)
|
public Task Handle(NotifyEventArgs<ItemHeader<string>> args)
|
||||||
{
|
{
|
||||||
if (args.Value is ItemHeader<string> header)
|
if (args.Sender is ItemHeader<string> header)
|
||||||
{
|
{
|
||||||
Name = header.Value;
|
Name = header.Value;
|
||||||
}
|
}
|
||||||
|
|||||||
+22
-21
@@ -4,7 +4,7 @@ using Toolkit.Foundation;
|
|||||||
namespace Wallet;
|
namespace Wallet;
|
||||||
|
|
||||||
public partial class ItemViewModel :
|
public partial class ItemViewModel :
|
||||||
ObservableCollection,
|
ObservableCollection<IItemViewModel>,
|
||||||
INotificationHandler<ConfirmEventArgs<Item>>,
|
INotificationHandler<ConfirmEventArgs<Item>>,
|
||||||
INotificationHandler<UpdateEventArgs<Item>>,
|
INotificationHandler<UpdateEventArgs<Item>>,
|
||||||
INotificationHandler<CancelEventArgs<Item>>
|
INotificationHandler<CancelEventArgs<Item>>
|
||||||
@@ -16,16 +16,16 @@ public partial class ItemViewModel :
|
|||||||
private bool favourite;
|
private bool favourite;
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
private ItemState state;
|
private bool fromCategory;
|
||||||
|
|
||||||
[ObservableProperty]
|
|
||||||
private string named;
|
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
private string name;
|
private string name;
|
||||||
|
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
private bool fromCategory;
|
private string named;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private ItemState state;
|
||||||
|
|
||||||
public ItemViewModel(IServiceProvider provider,
|
public ItemViewModel(IServiceProvider provider,
|
||||||
IServiceFactory factory,
|
IServiceFactory factory,
|
||||||
@@ -35,11 +35,11 @@ public partial class ItemViewModel :
|
|||||||
IDisposer disposer,
|
IDisposer disposer,
|
||||||
IContentTemplate template,
|
IContentTemplate template,
|
||||||
NamedComponent named,
|
NamedComponent named,
|
||||||
ItemState state = ItemState.Read,
|
|
||||||
bool fromCategory = false,
|
|
||||||
string name = "",
|
string name = "",
|
||||||
|
bool fromCategory = false,
|
||||||
bool favourite = false,
|
bool favourite = false,
|
||||||
bool archived = false) : base(provider, factory, mediator, publisher, subscriber, disposer)
|
bool archived = false,
|
||||||
|
ItemState state = ItemState.Read) : base(provider, factory, mediator, publisher, subscriber, disposer)
|
||||||
{
|
{
|
||||||
Template = template;
|
Template = template;
|
||||||
Named = $"{named}";
|
Named = $"{named}";
|
||||||
@@ -48,13 +48,19 @@ public partial class ItemViewModel :
|
|||||||
Favourite = favourite;
|
Favourite = favourite;
|
||||||
Archived = archived;
|
Archived = archived;
|
||||||
Name = name;
|
Name = name;
|
||||||
|
|
||||||
Add<ItemHeaderViewModel>("", name, state);
|
|
||||||
Add<ItemContentViewModel>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IContentTemplate Template { get; set; }
|
public IContentTemplate Template { get; set; }
|
||||||
|
|
||||||
|
public override void Dispose()
|
||||||
|
{
|
||||||
|
GC.SuppressFinalize(this);
|
||||||
|
Publisher.Publish(Notify.As(Factory.Create<ItemCommandHeaderCollection>(new
|
||||||
|
List<IDisposable>())));
|
||||||
|
|
||||||
|
base.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
public Task Handle(UpdateEventArgs<Item> args)
|
public Task Handle(UpdateEventArgs<Item> args)
|
||||||
{
|
{
|
||||||
Publisher.Publish(Notify.As(Factory.Create<ItemCommandHeaderCollection>(new List<IDisposable>
|
Publisher.Publish(Notify.As(Factory.Create<ItemCommandHeaderCollection>(new List<IDisposable>
|
||||||
@@ -67,14 +73,6 @@ public partial class ItemViewModel :
|
|||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Dispose()
|
|
||||||
{
|
|
||||||
Publisher.Publish(Notify.As(Factory.Create<ItemCommandHeaderCollection>(new
|
|
||||||
List<IDisposable>())));
|
|
||||||
|
|
||||||
base.Dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Task Handle(CancelEventArgs<Item> args)
|
public Task Handle(CancelEventArgs<Item> args)
|
||||||
{
|
{
|
||||||
Publisher.Publish(Notify.As(Factory.Create<ItemCommandHeaderCollection>(new List<IDisposable>
|
Publisher.Publish(Notify.As(Factory.Create<ItemCommandHeaderCollection>(new List<IDisposable>
|
||||||
@@ -95,7 +93,7 @@ public partial class ItemViewModel :
|
|||||||
Factory.Create<EditItemActionViewModel>(),
|
Factory.Create<EditItemActionViewModel>(),
|
||||||
Factory.Create<ArchiveItemActionViewModel>(),
|
Factory.Create<ArchiveItemActionViewModel>(),
|
||||||
})));
|
})));
|
||||||
|
|
||||||
Publisher.Publish(Confirm.As<Item>(),
|
Publisher.Publish(Confirm.As<Item>(),
|
||||||
State is ItemState.New ? nameof(ItemState.New) : nameof(ItemState.Write));
|
State is ItemState.New ? nameof(ItemState.New) : nameof(ItemState.Write));
|
||||||
|
|
||||||
@@ -135,4 +133,7 @@ public partial class ItemViewModel :
|
|||||||
|
|
||||||
return base.OnActivated();
|
return base.OnActivated();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override SynchronizeExpression BuildAggregateExpression() =>
|
||||||
|
new(Synchronize.As<IItemViewModel, (string, string, ItemState)>(("", Name, State)));
|
||||||
}
|
}
|
||||||
@@ -8,7 +8,7 @@ public class MaskedTextEntryViewModelHandler(IServiceFactory serviceFactory) :
|
|||||||
public Task<IItemEntryViewModel?> Handle(CreateEventArgs<MaskedTextEntryConfiguration> args,
|
public Task<IItemEntryViewModel?> Handle(CreateEventArgs<MaskedTextEntryConfiguration> args,
|
||||||
CancellationToken cancellationToken)
|
CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
if (args.Value is MaskedTextEntryConfiguration configuration)
|
if (args.Sender is MaskedTextEntryConfiguration configuration)
|
||||||
{
|
{
|
||||||
string? label = configuration.Label;
|
string? label = configuration.Label;
|
||||||
object? value = configuration.Value ?? "";
|
object? value = configuration.Value ?? "";
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ public class MultilineTextEntryViewModelHandler(IServiceFactory serviceFactory)
|
|||||||
public Task<IItemEntryViewModel?> Handle(CreateEventArgs<MultilineTextEntryConfiguration> args,
|
public Task<IItemEntryViewModel?> Handle(CreateEventArgs<MultilineTextEntryConfiguration> args,
|
||||||
CancellationToken cancellationToken)
|
CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
if (args.Value is MultilineTextEntryConfiguration configuration)
|
if (args.Sender is MultilineTextEntryConfiguration configuration)
|
||||||
{
|
{
|
||||||
string? label = configuration.Label;
|
string? label = configuration.Label;
|
||||||
object? value = configuration.Value ?? "";
|
object? value = configuration.Value ?? "";
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ public class OpenWalletHandler(IConfigurationDescriptor<WalletConfiguration> des
|
|||||||
public async Task<bool> Handle(ActivateEventArgs<Wallet<string>> args,
|
public async Task<bool> Handle(ActivateEventArgs<Wallet<string>> args,
|
||||||
CancellationToken cancellationToken)
|
CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
if (args.Value is Wallet<string> Wallet &&
|
if (args.Sender is Wallet<string> Wallet &&
|
||||||
descriptor.Name is { Length: > 0 } name &&
|
descriptor.Name is { Length: > 0 } name &&
|
||||||
Wallet.Value is { Length: > 0 } password)
|
Wallet.Value is { Length: > 0 } password)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ public class PasswordEntryViewModelHandler(IServiceFactory serviceFactory) :
|
|||||||
public Task<IItemEntryViewModel?> Handle(CreateEventArgs<PasswordEntryConfiguration> args,
|
public Task<IItemEntryViewModel?> Handle(CreateEventArgs<PasswordEntryConfiguration> args,
|
||||||
CancellationToken cancellationToken)
|
CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
if (args.Value is PasswordEntryConfiguration configuration)
|
if (args.Sender is PasswordEntryConfiguration configuration)
|
||||||
{
|
{
|
||||||
string? label = configuration.Label;
|
string? label = configuration.Label;
|
||||||
object? value = configuration.Value ?? "";
|
object? value = configuration.Value ?? "";
|
||||||
|
|||||||
@@ -19,20 +19,29 @@ public class QueryWalletHandler(IDbContextFactory<WalletContext> dbContextFactor
|
|||||||
ExpressionStarter<ItemEntry> predicate =
|
ExpressionStarter<ItemEntry> predicate =
|
||||||
PredicateBuilder.New<ItemEntry>(true);
|
PredicateBuilder.New<ItemEntry>(true);
|
||||||
|
|
||||||
|
if (filter is { Length: <= 0 })
|
||||||
|
{
|
||||||
|
return items;
|
||||||
|
}
|
||||||
|
|
||||||
if (filter == "All")
|
if (filter == "All")
|
||||||
{
|
{
|
||||||
predicate = predicate.And(x => x.State != 2);
|
predicate = predicate.And(x => x.State != 2);
|
||||||
}
|
}
|
||||||
|
else if (filter == "Starred")
|
||||||
if (filter == "Starred")
|
|
||||||
{
|
{
|
||||||
predicate = predicate.And(x => x.State != 2 && x.State == 1);
|
predicate = predicate.And(x => x.State != 2 && x.State == 1);
|
||||||
}
|
}
|
||||||
|
else if (filter == "Archive")
|
||||||
if (filter == "Archive")
|
|
||||||
{
|
{
|
||||||
predicate = predicate.And(x => x.State == 2);
|
predicate = predicate.And(x => x.State == 2);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
predicate = predicate.And(x => x.State != 2)
|
||||||
|
.And(x => EF.Functions.Like(x.Category, $"%{filter}%"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (text is { Length: > 0 })
|
if (text is { Length: > 0 })
|
||||||
{
|
{
|
||||||
|
|||||||
+4
-4
@@ -3,16 +3,16 @@ using Toolkit.Foundation;
|
|||||||
|
|
||||||
namespace Wallet;
|
namespace Wallet;
|
||||||
|
|
||||||
public class SynchronizeItemViewModelHandler(IMediator mediator,
|
public class SynchronizeItemCollectionViewModelHandler(IMediator mediator,
|
||||||
IServiceProvider serviceProvider,
|
IServiceProvider serviceProvider,
|
||||||
ICache<Item<(Guid, string)>> cache,
|
ICache<Item<(Guid, string)>> cache,
|
||||||
IPublisher publisher) :
|
IPublisher publisher) :
|
||||||
INotificationHandler<SynchronizeEventArgs<ItemNavigationViewModel, WalletViewModelConfiguration>>
|
INotificationHandler<SynchronizeEventArgs<ItemNavigationViewModel, ItemCollectionConfiguration>>
|
||||||
{
|
{
|
||||||
public async Task Handle(SynchronizeEventArgs<ItemNavigationViewModel,
|
public async Task Handle(SynchronizeEventArgs<ItemNavigationViewModel,
|
||||||
WalletViewModelConfiguration> args)
|
ItemCollectionConfiguration> args)
|
||||||
{
|
{
|
||||||
if (args.Value is WalletViewModelConfiguration configuration)
|
if (args.Value is ItemCollectionConfiguration configuration)
|
||||||
{
|
{
|
||||||
cache.Clear();
|
cache.Clear();
|
||||||
bool selected = true;
|
bool selected = true;
|
||||||
@@ -4,7 +4,7 @@ using Toolkit.Foundation;
|
|||||||
namespace Wallet;
|
namespace Wallet;
|
||||||
|
|
||||||
public class SynchronizeItemContentFromCategoryViewModelHandler(IItemConfigurationCollection configurations,
|
public class SynchronizeItemContentFromCategoryViewModelHandler(IItemConfigurationCollection configurations,
|
||||||
IDecoratorService<ItemConfiguration> decoratorItemConfiguration,
|
IDecoratorService<ItemConfiguration> itemConfigurationDecorator,
|
||||||
IServiceFactory serviceFactory,
|
IServiceFactory serviceFactory,
|
||||||
IMediator mediator,
|
IMediator mediator,
|
||||||
IPublisher publisher) :
|
IPublisher publisher) :
|
||||||
@@ -18,7 +18,7 @@ public class SynchronizeItemContentFromCategoryViewModelHandler(IItemConfigurati
|
|||||||
{
|
{
|
||||||
if (configurationFactory.Invoke() is ItemConfiguration configuration)
|
if (configurationFactory.Invoke() is ItemConfiguration configuration)
|
||||||
{
|
{
|
||||||
decoratorItemConfiguration.Set(configuration);
|
itemConfigurationDecorator.Set(configuration);
|
||||||
foreach (ItemSectionConfiguration configurationSection in configuration.Sections)
|
foreach (ItemSectionConfiguration configurationSection in configuration.Sections)
|
||||||
{
|
{
|
||||||
string id = $"{nameof(ItemSection)}:{Guid.NewGuid()}";
|
string id = $"{nameof(ItemSection)}:{Guid.NewGuid()}";
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ public class TextEntryViewModelHandler(IServiceFactory serviceFactory) :
|
|||||||
public Task<IItemEntryViewModel?> Handle(CreateEventArgs<TextEntryConfiguration> args,
|
public Task<IItemEntryViewModel?> Handle(CreateEventArgs<TextEntryConfiguration> args,
|
||||||
CancellationToken cancellationToken)
|
CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
if (args.Value is TextEntryConfiguration configuration)
|
if (args.Sender is TextEntryConfiguration configuration)
|
||||||
{
|
{
|
||||||
string? label = configuration.Label;
|
string? label = configuration.Label;
|
||||||
object? value = configuration.Value ?? "";
|
object? value = configuration.Value ?? "";
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ public class WalletActivatedHandler(IWalletHostCollection Wallets,
|
|||||||
{
|
{
|
||||||
public Task Handle(ActivatedEventArgs<IComponentHost> args)
|
public Task Handle(ActivatedEventArgs<IComponentHost> args)
|
||||||
{
|
{
|
||||||
if (args.Value is IComponentHost Wallet)
|
if (args.Sender is IComponentHost Wallet)
|
||||||
{
|
{
|
||||||
List<IComponentHost> sortedWallets = [.. Wallets, Wallet];
|
List<IComponentHost> sortedWallets = [.. Wallets, Wallet];
|
||||||
sortedWallets = [.. sortedWallets.OrderBy(x => x.Services.GetRequiredService<IConfigurationDescriptor<WalletConfiguration>>() is
|
sortedWallets = [.. sortedWallets.OrderBy(x => x.Services.GetRequiredService<IConfigurationDescriptor<WalletConfiguration>>() is
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ public partial class WalletHeaderViewModel(IServiceProvider provider,
|
|||||||
{
|
{
|
||||||
Clear();
|
Clear();
|
||||||
|
|
||||||
if (args.Value is WalletCommandHeaderCollection commandCollection)
|
if (args.Sender is WalletCommandHeaderCollection commandCollection)
|
||||||
{
|
{
|
||||||
foreach (IDisposable command in commandCollection)
|
foreach (IDisposable command in commandCollection)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user