Got adding working again
This commit is contained in:
@@ -68,7 +68,8 @@ public partial class App : Application
|
||||
}
|
||||
});
|
||||
|
||||
services.AddHandler<QueryContainerHandler>(ServiceLifetime.Singleton);
|
||||
services.AddHandler<QueryContainerHandler>();
|
||||
services.AddHandler<CreateItemHander>();
|
||||
|
||||
services.AddHandler<OpenContainerHandler>();
|
||||
|
||||
@@ -91,6 +92,7 @@ public partial class App : Application
|
||||
|
||||
services.AddTemplate<ItemNavigationViewModel, ItemNavigationView>();
|
||||
services.AddTemplate<ItemViewModel, ItemView>("Item");
|
||||
services.AddHandler<AggerateItemViewModelHandler>();
|
||||
|
||||
services.AddTemplate<ItemCommandHeaderViewModel, ItemCommandHeaderView>("ItemCommandHeader");
|
||||
|
||||
@@ -111,6 +113,8 @@ public partial class App : Application
|
||||
services.AddHandler<UnarchiveItemHandler>(ServiceLifetime.Scoped);
|
||||
services.AddHandler<FavouriteItemHandler>(ServiceLifetime.Scoped);
|
||||
services.AddHandler<UnfavouriteItemHandler>(ServiceLifetime.Scoped);
|
||||
|
||||
services.AddHandler<ItemActivatedHandler>(ServiceLifetime.Singleton);
|
||||
});
|
||||
})!);
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
HotKey="Delete"
|
||||
ToolTip.Tip="Archive">
|
||||
<TextBlock
|
||||
Margin="0,3,0,0"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="{DynamicResource FluentThemeFontFamily}"
|
||||
FontSize="16"
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
Foreground="{DynamicResource IconForegroundBrush}"
|
||||
ToolTip.Tip="Save">
|
||||
<TextBlock
|
||||
Margin="0,3,0,0"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="{DynamicResource FluentThemeFontFamily}"
|
||||
FontSize="16"
|
||||
|
||||
@@ -4,5 +4,16 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="using:Bitvault"
|
||||
x:DataType="vm:ContainerHeaderViewModel">
|
||||
<ItemsControl ItemTemplate="{ReflectionBinding Template}" ItemsSource="{Binding}" />
|
||||
<ItemsControl ItemTemplate="{ReflectionBinding Template}" ItemsSource="{Binding}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<Grid ColumnDefinitions="Auto,6,*" />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.Styles>
|
||||
<Style Selector="ContentPresenter">
|
||||
<Setter Property="Grid.Column" Value="{ReflectionBinding Index}" />
|
||||
</Style>
|
||||
</ItemsControl.Styles>
|
||||
</ItemsControl>
|
||||
</UserControl>
|
||||
|
||||
@@ -4,14 +4,17 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="using:Bitvault"
|
||||
x:DataType="vm:ContainerViewModel">
|
||||
<Grid ColumnDefinitions="320,Auto,*" RowDefinitions="Auto,*">
|
||||
<Grid
|
||||
x:Name="Container"
|
||||
ColumnDefinitions="320,Auto,*,Auto"
|
||||
Grid.IsSharedSizeScope="True"
|
||||
RowDefinitions="Auto,*">
|
||||
<Grid
|
||||
x:Name="Title"
|
||||
Grid.Row="0"
|
||||
Grid.ColumnSpan="3"
|
||||
Height="44"
|
||||
ColumnDefinitions="*, Auto">
|
||||
<ContentControl Grid.Column="0" VerticalAlignment="Center">
|
||||
Margin="8,0,0,0">
|
||||
<ContentControl VerticalAlignment="Center">
|
||||
<Interaction.Behaviors>
|
||||
<AttachedBehaviour>
|
||||
<NavigateAction Region="{Binding $self}" Route="ContainerHeader" />
|
||||
@@ -42,6 +45,7 @@
|
||||
<Border
|
||||
Grid.Row="1"
|
||||
Grid.Column="2"
|
||||
Grid.ColumnSpan="2"
|
||||
Background="{DynamicResource CardBackgroundFillColorDefaultBrush}"
|
||||
BorderBrush="{DynamicResource ControlStrokeColorDefaultBrush}"
|
||||
BorderThickness="1,1,0,0"
|
||||
|
||||
@@ -14,7 +14,7 @@ public partial class ContainerView : UserControl
|
||||
|
||||
if (VisualRoot is AppWindow appWindow)
|
||||
{
|
||||
Title.ColumnDefinitions[1].Width = new GridLength(appWindow.TitleBar.RightInset, GridUnitType.Pixel);
|
||||
Container.ColumnDefinitions[3].Width = new GridLength(appWindow.TitleBar.RightInset, GridUnitType.Pixel);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,16 +5,33 @@
|
||||
xmlns:vm="using:Bitvault"
|
||||
x:DataType="vm:CreateItemActionViewModel">
|
||||
<Button
|
||||
Grid.Column="1"
|
||||
Width="{StaticResource ButtonWidth}"
|
||||
Height="{StaticResource ButtonHeight}"
|
||||
VerticalAlignment="Center"
|
||||
Content=""
|
||||
Height="32"
|
||||
MinWidth="144"
|
||||
HorizontalContentAlignment="Center"
|
||||
Classes="accent"
|
||||
CornerRadius="16"
|
||||
FontFamily="{DynamicResource SymbolThemeFontFamily}"
|
||||
FontSize="16"
|
||||
ToolTip.Tip="Add item">
|
||||
ToolTip.Tip="New Item">
|
||||
<Grid ColumnDefinitions="Auto,8,*">
|
||||
<TextBlock
|
||||
Grid.Column="0"
|
||||
Margin="-6,3,0,0"
|
||||
FontFamily="{DynamicResource FluentThemeFontFamily}"
|
||||
FontSize="16"
|
||||
Foreground="{DynamicResource IconForegroundBrush}"
|
||||
Text="" />
|
||||
<TextBlock
|
||||
Grid.Column="2"
|
||||
Margin="0,2,0,0"
|
||||
Foreground="{DynamicResource IconForegroundBrush}"
|
||||
Text="New Item" />
|
||||
</Grid>
|
||||
<Interaction.Behaviors>
|
||||
<EventTriggerBehavior EventName="Click">
|
||||
<NavigateAction
|
||||
Region="{Binding Named, StringFormat='{}{0}:ContentHeader'}"
|
||||
Route="ItemCommandHeader"
|
||||
Scope="self" />
|
||||
<NavigateAction
|
||||
Region="{Binding Named, StringFormat='{}{0}:Content'}"
|
||||
Route="Item"
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
Foreground="{DynamicResource IconForegroundBrush}"
|
||||
ToolTip.Tip="Delete">
|
||||
<TextBlock
|
||||
Margin="0,3,0,0"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="{DynamicResource SymbolThemeFontFamily}"
|
||||
FontSize="16"
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
Foreground="{DynamicResource IconForegroundBrush}"
|
||||
ToolTip.Tip="Cancel">
|
||||
<TextBlock
|
||||
Margin="0,3,0,0"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="{DynamicResource FluentThemeFontFamily}"
|
||||
FontSize="16"
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
Foreground="{DynamicResource IconForegroundBrush}"
|
||||
ToolTip.Tip="Edit">
|
||||
<TextBlock
|
||||
Margin="0,3,0,0"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="{DynamicResource FluentThemeFontFamily}"
|
||||
FontSize="16"
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
Route="Item"
|
||||
Scope="self">
|
||||
<NavigateAction.ParameterBindings>
|
||||
<ParameterBinding Key="Immutable" Value="{x:True}" />
|
||||
<ParameterBinding Key="Archived" Value="{Binding Archived}" />
|
||||
<ParameterBinding Key="Favourite" Value="{Binding Favourite}" />
|
||||
</NavigateAction.ParameterBindings>
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
MaxWidth="500"
|
||||
CornerRadius="16"
|
||||
Text="{Binding Value}"
|
||||
TextBlock.TextAlignment="Center"
|
||||
Watermark="Search">
|
||||
<Interaction.Behaviors>
|
||||
<KeyBindingTriggerBehaviour Gesture="Enter">
|
||||
|
||||
@@ -7,9 +7,9 @@ public class AggerateContainerViewModelHandler(IMediator mediator,
|
||||
IServiceProvider serviceProvider,
|
||||
ICache<Item> cache,
|
||||
IPublisher publisher) :
|
||||
INotificationHandler<Aggerate<ItemNavigationViewModel, ContainerViewModelConfiguration>>
|
||||
INotificationHandler<AggerateEventArgs<ItemNavigationViewModel, ContainerViewModelConfiguration>>
|
||||
{
|
||||
public async Task Handle(Aggerate<ItemNavigationViewModel,
|
||||
public async Task Handle(AggerateEventArgs<ItemNavigationViewModel,
|
||||
ContainerViewModelConfiguration> args)
|
||||
{
|
||||
if (args.Options is ContainerViewModelConfiguration configuration)
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
using Toolkit.Foundation;
|
||||
|
||||
namespace Bitvault;
|
||||
|
||||
public class AggerateItemViewModelHandler(IMediator mediator,
|
||||
IServiceFactory serviceFactory,
|
||||
IPublisher publisher) :
|
||||
INotificationHandler<AggerateEventArgs<IItemEntryViewModel>>
|
||||
{
|
||||
public Task Handle(AggerateEventArgs<IItemEntryViewModel> args)
|
||||
{
|
||||
if (serviceFactory.Create<ItemHeaderViewModel>(false) is ItemHeaderViewModel viewModel)
|
||||
{
|
||||
publisher.Publish(Create.As<IItemEntryViewModel>(viewModel), nameof(ItemViewModel));
|
||||
}
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
@@ -2,15 +2,21 @@
|
||||
|
||||
namespace Bitvault;
|
||||
|
||||
public class ConfirmItemHandler(IMediator mediator) :
|
||||
public class ConfirmItemHandler(IMediator mediator,
|
||||
IPublisher publisher) :
|
||||
INotificationHandler<ConfirmEventArgs<Item>>
|
||||
{
|
||||
public async Task Handle(ConfirmEventArgs<Item> args)
|
||||
{
|
||||
(bool result, int index) result = await mediator.Handle<CreateEventArgs<ItemConfiguration>,
|
||||
(bool, int)>(new CreateEventArgs<ItemConfiguration>(new ItemConfiguration()));
|
||||
|
||||
ItemHeaderConfiguration? configuration = await mediator.Handle<ConfirmEventArgs<Item>,
|
||||
ItemHeaderConfiguration>(args);
|
||||
|
||||
(bool Success, int Id, string Name) result = await mediator.Handle<CreateEventArgs<ItemConfiguration>,
|
||||
(bool, int, string)>(new CreateEventArgs<ItemConfiguration>(new ItemConfiguration { Name = configuration?.Name }));
|
||||
|
||||
if (result.Success)
|
||||
{
|
||||
publisher.Publish(Activated.As(new Item { Id = result.Id, Name = result.Name }));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,20 +15,9 @@ public partial class ContainerHeaderViewModel :
|
||||
{
|
||||
Template = template;
|
||||
|
||||
Add<SearchContainerActionViewModel>();
|
||||
|
||||
//Add<CreateItemActionViewModel>(scope: true);
|
||||
Add<CreateItemActionViewModel>(0);
|
||||
Add<SearchContainerActionViewModel>(2);
|
||||
}
|
||||
|
||||
public IContentTemplate Template { get; set; }
|
||||
|
||||
//public Task Handle(RequestEventArgs<Filter<string>> args)
|
||||
//{
|
||||
// if (args.Value is Filter<string> filter)
|
||||
// {
|
||||
// Value = filter.Value;
|
||||
// }
|
||||
|
||||
// return Task.CompletedTask;
|
||||
//}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ using Toolkit.Foundation;
|
||||
namespace Bitvault;
|
||||
|
||||
|
||||
[Enumerate(nameof(ContainerViewModel))]
|
||||
[Aggerate(nameof(ContainerViewModel))]
|
||||
public partial class ContainerViewModel(IServiceProvider provider,
|
||||
IServiceFactory factory,
|
||||
IMediator mediator,
|
||||
@@ -13,7 +13,7 @@ public partial class ContainerViewModel(IServiceProvider provider,
|
||||
IDisposer disposer,
|
||||
IContentTemplate template,
|
||||
NamedComponent named,
|
||||
ContainerViewModelConfiguration configuration) : Toolkit.Foundation.ObservableCollection<ItemNavigationViewModel>(provider, factory, mediator, publisher, subscriber, disposer),
|
||||
ContainerViewModelConfiguration configuration) : ObservableCollection<ItemNavigationViewModel>(provider, factory, mediator, publisher, subscriber, disposer),
|
||||
INotificationHandler<NotifyEventArgs<Filter>>,
|
||||
INotificationHandler<NotifyEventArgs<Search>>
|
||||
{
|
||||
@@ -39,7 +39,7 @@ public partial class ContainerViewModel(IServiceProvider provider,
|
||||
if (args.Value is Filter filter)
|
||||
{
|
||||
configuration = configuration with { Filter = filter.Value };
|
||||
Aggerate();
|
||||
BeginAggregation();
|
||||
}
|
||||
|
||||
return Task.CompletedTask;
|
||||
@@ -49,12 +49,12 @@ public partial class ContainerViewModel(IServiceProvider provider,
|
||||
if (args.Value is Search search)
|
||||
{
|
||||
configuration = configuration with { Query = search.Value };
|
||||
Aggerate();
|
||||
BeginAggregation();
|
||||
}
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
protected override IAggerate OnAggerate(object? key) =>
|
||||
AggerateEventArgs<ItemNavigationViewModel>.With(configuration) with { Key = key };
|
||||
protected override IAggerate OnPrepareAggregation(object? key) =>
|
||||
Aggerate.With<ItemNavigationViewModel, ContainerViewModelConfiguration>(configuration) with { Key = key };
|
||||
}
|
||||
@@ -9,8 +9,11 @@ public partial class CreateItemActionViewModel(IServiceProvider provider,
|
||||
IPublisher publisher,
|
||||
ISubscription subscriber,
|
||||
IDisposer disposer,
|
||||
NamedComponent named) : Observable(provider, factory, mediator, publisher, subscriber, disposer)
|
||||
NamedComponent named,
|
||||
int index) : Observable(provider, factory, mediator, publisher, subscriber, disposer)
|
||||
{
|
||||
[ObservableProperty]
|
||||
private int index = index;
|
||||
|
||||
[ObservableProperty]
|
||||
private string named = $"{named}";
|
||||
|
||||
@@ -6,9 +6,9 @@ using Toolkit.Foundation;
|
||||
namespace Bitvault;
|
||||
|
||||
public class CreateItemHander(IDbContextFactory<ContainerDbContext> dbContextFactory) :
|
||||
IHandler<CreateEventArgs<ItemConfiguration>, (bool, int)>
|
||||
IHandler<CreateEventArgs<ItemConfiguration>, (bool, int, string?)>
|
||||
{
|
||||
public async Task<(bool, int)> Handle(CreateEventArgs<ItemConfiguration> args,
|
||||
public async Task<(bool, int, string?)> Handle(CreateEventArgs<ItemConfiguration> args,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
if (args.Value is ItemConfiguration configuration)
|
||||
@@ -27,7 +27,7 @@ public class CreateItemHander(IDbContextFactory<ContainerDbContext> dbContextFac
|
||||
|
||||
if (result is not null)
|
||||
{
|
||||
return (false, -1);
|
||||
return (true, result.Entity.Id, result.Entity.Name);
|
||||
}
|
||||
}
|
||||
catch
|
||||
@@ -36,6 +36,6 @@ public class CreateItemHander(IDbContextFactory<ContainerDbContext> dbContextFac
|
||||
}
|
||||
}
|
||||
|
||||
return (false, -1);
|
||||
return (false, -1, "");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace Bitvault;
|
||||
|
||||
public interface IItemEntryViewModel :
|
||||
IDisposable
|
||||
{
|
||||
|
||||
}
|
||||
@@ -4,3 +4,28 @@ using Toolkit.Foundation;
|
||||
|
||||
namespace Bitvault;
|
||||
|
||||
public class ItemActivatedHandler(IServiceProvider serviceProvider,
|
||||
ICache<Item> cache,
|
||||
IPublisher publisher) :
|
||||
INotificationHandler<ActivatedEventArgs<Item>>
|
||||
{
|
||||
public Task Handle(ActivatedEventArgs<Item> args)
|
||||
{
|
||||
if (args.Value is Item item)
|
||||
{
|
||||
IServiceScope serviceScope = serviceProvider.CreateScope();
|
||||
IServiceFactory serviceFactory = serviceScope.ServiceProvider.GetRequiredService<IServiceFactory>();
|
||||
|
||||
cache.Add(item);
|
||||
int index = cache.IndexOf(item);
|
||||
|
||||
if (serviceFactory.Create<ItemNavigationViewModel>(item.Id, item.Name, "Description " + 1, true)
|
||||
is ItemNavigationViewModel viewModel)
|
||||
{
|
||||
publisher.Publish(Insert.As(index, viewModel), nameof(ContainerViewModel));
|
||||
}
|
||||
}
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@ public partial class ItemCommandHeaderViewModel(IServiceProvider provider,
|
||||
public Task Handle(NotifyEventArgs<CommandCollection> args)
|
||||
{
|
||||
Clear();
|
||||
|
||||
if (args.Value is CommandCollection commandCollection)
|
||||
{
|
||||
foreach (IDisposable command in commandCollection)
|
||||
|
||||
@@ -12,7 +12,8 @@ public partial class ItemHeaderViewModel(IServiceProvider provider,
|
||||
bool immutable,
|
||||
string? value = null) : Observable<string, string>(provider, factory, mediator, publisher, subscriber, disposer, value),
|
||||
IHandler<ValidationEventArgs<Item>, bool>,
|
||||
IHandler<ConfirmEventArgs<Item>, ItemHeaderConfiguration>
|
||||
IHandler<ConfirmEventArgs<Item>, ItemHeaderConfiguration>,
|
||||
IItemEntryViewModel
|
||||
{
|
||||
[ObservableProperty]
|
||||
private bool immutable = immutable;
|
||||
@@ -20,7 +21,6 @@ public partial class ItemHeaderViewModel(IServiceProvider provider,
|
||||
public Task<bool> Handle(ValidationEventArgs<Item> args,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
// we need to work on the local validation layer
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,8 +15,8 @@ public partial class ItemNavigationViewModel(IServiceProvider provider,
|
||||
string name,
|
||||
string description,
|
||||
bool selected,
|
||||
bool favourite,
|
||||
bool archived) :
|
||||
bool favourite = false,
|
||||
bool archived = false) :
|
||||
Observable(provider, factory, mediator, publisher, subscriber, disposer),
|
||||
INotificationHandler<ArchiveEventArgs<Item>>,
|
||||
INotificationHandler<UnarchiveEventArgs<Item>>,
|
||||
|
||||
+41
-18
@@ -3,14 +3,21 @@ using Toolkit.Foundation;
|
||||
|
||||
namespace Bitvault;
|
||||
|
||||
[Aggerate(nameof(ItemViewModel))]
|
||||
public partial class ItemViewModel :
|
||||
ObservableCollection<IDisposable>,
|
||||
ObservableCollection<IItemEntryViewModel>,
|
||||
INotificationHandler<EditEventArgs<Item>>,
|
||||
INotificationHandler<CancelEventArgs<Item>>
|
||||
{
|
||||
[ObservableProperty]
|
||||
private bool archived;
|
||||
|
||||
[ObservableProperty]
|
||||
private bool favourite;
|
||||
|
||||
[ObservableProperty]
|
||||
private bool immutable;
|
||||
|
||||
public ItemViewModel(IServiceProvider provider,
|
||||
IServiceFactory factory,
|
||||
IMediator mediator,
|
||||
@@ -18,28 +25,14 @@ public partial class ItemViewModel :
|
||||
ISubscription subscriber,
|
||||
IDisposer disposer,
|
||||
IContentTemplate template,
|
||||
bool immutable = true,
|
||||
bool favourite = false,
|
||||
bool archived = false) : base(provider, factory, mediator, publisher, subscriber, disposer)
|
||||
{
|
||||
Template = template;
|
||||
Immutable = immutable;
|
||||
Favourite = favourite;
|
||||
Archived = archived;
|
||||
|
||||
if (!Archived)
|
||||
{
|
||||
Publisher.Publish(Notify.As(Factory.Create<CommandCollection>(new List<IDisposable>
|
||||
{
|
||||
Factory.Create<FavouriteItemActionViewModel>(favourite),
|
||||
Factory.Create<EditItemActionViewModel>(),
|
||||
Factory.Create<ArchiveItemActionViewModel>(),
|
||||
})));
|
||||
}
|
||||
else
|
||||
{
|
||||
Publisher.Publish(Notify.As(Factory.Create<CommandCollection>(new List<IDisposable>
|
||||
{
|
||||
Factory.Create<UnarchiveItemActionViewModel>(),
|
||||
})));
|
||||
}
|
||||
}
|
||||
|
||||
public IContentTemplate Template { get; set; }
|
||||
@@ -65,4 +58,34 @@ public partial class ItemViewModel :
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public override Task OnActivated()
|
||||
{
|
||||
if (!Immutable)
|
||||
{
|
||||
Publisher.Publish(Notify.As(Factory.Create<CommandCollection>(new List<IDisposable>
|
||||
{
|
||||
Factory.Create<ConfirmItemActionViewModel>(),
|
||||
Factory.Create<DismissItemActionViewModel>(),
|
||||
})));
|
||||
}
|
||||
else if (Archived)
|
||||
{
|
||||
Publisher.Publish(Notify.As(Factory.Create<CommandCollection>(new List<IDisposable>
|
||||
{
|
||||
Factory.Create<UnarchiveItemActionViewModel>(),
|
||||
})));
|
||||
}
|
||||
else
|
||||
{
|
||||
Publisher.Publish(Notify.As(Factory.Create<CommandCollection>(new List<IDisposable>
|
||||
{
|
||||
Factory.Create<FavouriteItemActionViewModel>(Favourite),
|
||||
Factory.Create<EditItemActionViewModel>(),
|
||||
Factory.Create<ArchiveItemActionViewModel>(),
|
||||
})));
|
||||
}
|
||||
|
||||
return base.OnActivated();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ using Toolkit.Foundation;
|
||||
|
||||
namespace Bitvault;
|
||||
|
||||
[Enumerate(nameof(MainViewModel))]
|
||||
[Aggerate(nameof(MainViewModel))]
|
||||
public partial class MainViewModel :
|
||||
ObservableCollection<IMainNavigationViewModel>
|
||||
{
|
||||
|
||||
@@ -5,4 +5,4 @@ public record QueryContainerConfiguration
|
||||
public string? Filter { get; set; }
|
||||
|
||||
public string? Query { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,21 @@ using Toolkit.Foundation;
|
||||
|
||||
namespace Bitvault;
|
||||
|
||||
public class QueryItemHandler(IDbContextFactory<ContainerDbContext> dbContextFactory) :
|
||||
IHandler<RequestEventArgs<QueryItemConfiguration>, (int Id, string? Name)>
|
||||
{
|
||||
public Task<(int Id, string? Name)> Handle(RequestEventArgs<QueryItemConfiguration> args,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
public record QueryItemConfiguration
|
||||
{
|
||||
public int Id { get; set; }
|
||||
}
|
||||
|
||||
public class QueryContainerHandler(IDbContextFactory<ContainerDbContext> dbContextFactory) :
|
||||
IHandler<RequestEventArgs<QueryContainerConfiguration>, IReadOnlyCollection<(int Id, string? Name, bool Favourite, bool Archived)>>
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Toolkit.Foundation;
|
||||
|
||||
namespace Bitvault;
|
||||
@@ -8,8 +9,12 @@ public partial class SearchContainerActionViewModel(IServiceProvider provider,
|
||||
IMediator mediator,
|
||||
IPublisher publisher,
|
||||
ISubscription subscriber,
|
||||
IDisposer disposer) : Observable<string>(provider, factory, mediator, publisher, subscriber, disposer)
|
||||
IDisposer disposer,
|
||||
int index) : Observable<string>(provider, factory, mediator, publisher, subscriber, disposer)
|
||||
{
|
||||
[ObservableProperty]
|
||||
private int index = index;
|
||||
|
||||
[RelayCommand]
|
||||
public void Invoke() => Publisher.Publish(Notify.As(new Search(Value)),
|
||||
nameof(ContainerViewModel));
|
||||
|
||||
Reference in New Issue
Block a user