Fix more edge cases
This commit is contained in:
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Bitvault;
|
||||
|
||||
public class AggerateItemCategoryViewModelHandler(IEnumerable<IConfigurationDescriptor<ItemConfiguration>> descriptors,
|
||||
public class AggregateItemCategoryViewModelHandler(IEnumerable<IConfigurationDescriptor<ItemConfiguration>> descriptors,
|
||||
IServiceFactory serviceFactory,
|
||||
IPublisher publisher) :
|
||||
INotificationHandler<AggerateEventArgs<ItemCategoryNavigationViewModel>>
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Bitvault;
|
||||
|
||||
public class AggerateItemContentViewModelHandler(IValueStore<Item<(Guid, string)>> valueStore,
|
||||
public class AggregateItemContentViewModelHandler(IValueStore<Item<(Guid, string)>> valueStore,
|
||||
IMediator mediator,
|
||||
IServiceFactory serviceFactory,
|
||||
IPublisher publisher) :
|
||||
+5
-3
@@ -6,13 +6,15 @@ namespace Bitvault;
|
||||
public class AggerateItemViewModelHandler(IMediator mediator,
|
||||
IServiceProvider serviceProvider,
|
||||
ICache<Item<(Guid, string)>> cache,
|
||||
IPublisher publisher) :
|
||||
INotificationHandler<AggerateEventArgs<ItemNavigationViewModel,
|
||||
IPublisher publisher,
|
||||
LockerViewModelConfiguration dd) :
|
||||
INotificationHandler<AggregateEventArgs<ItemNavigationViewModel,
|
||||
LockerViewModelConfiguration>>
|
||||
{
|
||||
public async Task Handle(AggerateEventArgs<ItemNavigationViewModel,
|
||||
public async Task Handle(AggregateEventArgs<ItemNavigationViewModel,
|
||||
LockerViewModelConfiguration> args)
|
||||
{
|
||||
var ddddd = dd;
|
||||
if (args.Options is LockerViewModelConfiguration configuration)
|
||||
{
|
||||
cache.Clear();
|
||||
+1
-1
@@ -3,7 +3,7 @@ using Toolkit.Foundation;
|
||||
|
||||
namespace Bitvault;
|
||||
|
||||
public class AggerateMainViewModelHandler(IPublisher publisher,
|
||||
public class AggregateMainViewModelHandler(IPublisher publisher,
|
||||
ILockerHostCollection lockers) :
|
||||
INotificationHandler<AggerateEventArgs<IMainNavigationViewModel>>
|
||||
{
|
||||
@@ -1,5 +1,4 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Toolkit.Foundation;
|
||||
|
||||
namespace Bitvault;
|
||||
@@ -13,8 +12,4 @@ public partial class BackActionViewModel(IServiceProvider provider,
|
||||
{
|
||||
[ObservableProperty]
|
||||
private int index = 0;
|
||||
|
||||
[RelayCommand]
|
||||
public void Invoke() => Publisher.Publish(Notify.As(new Search(Value)),
|
||||
nameof(ItemCollectionViewModel));
|
||||
}
|
||||
@@ -13,5 +13,5 @@ public partial class ConfirmItemActionViewModel(IServiceProvider provider,
|
||||
{
|
||||
[RelayCommand]
|
||||
public void Invoke() => Publisher.Publish(Confirm.As<Item>(),
|
||||
state is ItemState.New ? nameof(Create) : nameof(Update));
|
||||
state is ItemState.New ? nameof(ItemState.New) : nameof(ItemState.Write));
|
||||
}
|
||||
@@ -7,10 +7,11 @@ namespace Bitvault;
|
||||
[Notification(typeof(CreateEventArgs<ItemNavigationViewModel>), nameof(ItemCollectionViewModel))]
|
||||
[Notification(typeof(InsertEventArgs<ItemNavigationViewModel>), nameof(ItemCollectionViewModel))]
|
||||
[Notification(typeof(MoveToEventArgs<ItemNavigationViewModel>), nameof(ItemCollectionViewModel))]
|
||||
[Notification(typeof(NotifyEventArgs<Search<string>>), nameof(ItemCollectionViewModel))]
|
||||
public partial class ItemCollectionViewModel :
|
||||
ObservableCollection<ItemNavigationViewModel>,
|
||||
INotificationHandler<NotifyEventArgs<Filter>>,
|
||||
INotificationHandler<NotifyEventArgs<Search>>,
|
||||
INotificationHandler<NotifyEventArgs<Search<string>>>,
|
||||
IBackStack
|
||||
{
|
||||
[ObservableProperty]
|
||||
@@ -42,18 +43,18 @@ public partial class ItemCollectionViewModel :
|
||||
if (args.Value is Filter filter)
|
||||
{
|
||||
configuration = configuration with { Filter = filter.Value };
|
||||
BeginAggregation();
|
||||
Fetch(true);
|
||||
}
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public Task Handle(NotifyEventArgs<Search> args)
|
||||
public Task Handle(NotifyEventArgs<Search<string>> args)
|
||||
{
|
||||
if (args.Value is Search search)
|
||||
if (args.Value is Search<string> search)
|
||||
{
|
||||
configuration = configuration with { Query = search.Value };
|
||||
BeginAggregation();
|
||||
Fetch(true);
|
||||
}
|
||||
|
||||
return Task.CompletedTask;
|
||||
@@ -70,11 +71,6 @@ public partial class ItemCollectionViewModel :
|
||||
return base.OnActivated();
|
||||
}
|
||||
|
||||
public override Task OnDeactivated()
|
||||
{
|
||||
return base.OnDeactivated();
|
||||
}
|
||||
protected override IAggerate OnAggerate(object? key) =>
|
||||
Aggerate.With<ItemNavigationViewModel, LockerViewModelConfiguration>(configuration)
|
||||
with { Key = key };
|
||||
protected override AggregateExpression CreateAggregateExpression() =>
|
||||
new(Aggregate.As<ItemNavigationViewModel, LockerViewModelConfiguration>(configuration));
|
||||
}
|
||||
|
||||
@@ -21,12 +21,6 @@ public partial class ItemContentViewModel :
|
||||
|
||||
public IContentTemplate Template { get; set; }
|
||||
|
||||
protected override IAggerate OnAggerate(object? key)
|
||||
{
|
||||
return base.OnAggerate(key);
|
||||
}
|
||||
|
||||
|
||||
public Task Handle(NotifyEventArgs<ItemCategory<string>> args)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using Toolkit.Foundation;
|
||||
using Toolkit.UI.Avalonia;
|
||||
|
||||
namespace Bitvault;
|
||||
|
||||
@@ -48,6 +49,7 @@ public partial class ItemNavigationViewModel(IServiceProvider provider,
|
||||
private bool selected = selected;
|
||||
|
||||
public IContentTemplate Template { get; set; } = template;
|
||||
public bool Attached { get; set; }
|
||||
|
||||
public Task Handle(ArchiveEventArgs<Item> args) =>
|
||||
Task.Run(Dispose);
|
||||
|
||||
@@ -3,13 +3,13 @@ using Toolkit.Foundation;
|
||||
|
||||
namespace Bitvault;
|
||||
|
||||
[Notification(typeof(ConfirmEventArgs<Item>), nameof(Create))]
|
||||
[Notification(typeof(ConfirmEventArgs<Item>), nameof(ItemState.New))]
|
||||
[Notification(typeof(ConfirmEventArgs<Item>), nameof(ItemState.Write))]
|
||||
public partial class ItemViewModel :
|
||||
ObservableCollection<IItemEntryViewModel>,
|
||||
INotificationHandler<UpdateEventArgs<Item>>,
|
||||
INotificationHandler<ConfirmEventArgs<Item>>,
|
||||
INotificationHandler<CancelEventArgs<Item>>
|
||||
|
||||
{
|
||||
[ObservableProperty]
|
||||
private bool archived;
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
namespace Bitvault;
|
||||
|
||||
public record Search(string? Value);
|
||||
public record Search<TValue>(TValue? Value);
|
||||
@@ -15,6 +15,6 @@ public partial class SearchLockerActionViewModel(IServiceProvider provider,
|
||||
private int index = 2;
|
||||
|
||||
[RelayCommand]
|
||||
public void Invoke() => Publisher.Publish(Notify.As(new Search(Value)),
|
||||
public void Invoke() => Publisher.Publish(Notify.As(new Search<string>(Value)),
|
||||
nameof(ItemCollectionViewModel));
|
||||
}
|
||||
Reference in New Issue
Block a user