Parameter improvements
This commit is contained in:
@@ -1,8 +0,0 @@
|
|||||||
using Avalonia.Controls;
|
|
||||||
|
|
||||||
namespace Bitvault.Avalonia;
|
|
||||||
|
|
||||||
public partial class AddItemContentNavigationView : UserControl
|
|
||||||
{
|
|
||||||
public AddItemContentNavigationView() => InitializeComponent();
|
|
||||||
}
|
|
||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
<UserControl
|
<UserControl
|
||||||
x:Class="Bitvault.Avalonia.AddItemContentNavigationView"
|
x:Class="Bitvault.Avalonia.AddItemNavigationView"
|
||||||
xmlns="https://github.com/avaloniaui"
|
xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||||
<SettingsExpander Header="Add item" IsClickEnabled="True" />
|
<SettingsExpander Header="Add item" IsClickEnabled="True" />
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
using Avalonia.Controls;
|
||||||
|
|
||||||
|
namespace Bitvault.Avalonia;
|
||||||
|
|
||||||
|
public partial class AddItemNavigationView : UserControl
|
||||||
|
{
|
||||||
|
public AddItemNavigationView() => InitializeComponent();
|
||||||
|
}
|
||||||
@@ -15,9 +15,7 @@
|
|||||||
</ConditionalExpression>
|
</ConditionalExpression>
|
||||||
</ConditionAction.Condition>
|
</ConditionAction.Condition>
|
||||||
<NavigateAction Region="Main" Route="Container">
|
<NavigateAction Region="Main" Route="Container">
|
||||||
<NavigateAction.ParameterBindings>
|
<Parameter Key="Filter" Value="{Binding Filter}" />
|
||||||
<ParameterBinding Key="Filter" Value="{Binding Filter}" />
|
|
||||||
</NavigateAction.ParameterBindings>
|
|
||||||
</NavigateAction>
|
</NavigateAction>
|
||||||
</ConditionAction>
|
</ConditionAction>
|
||||||
<ConditionAction>
|
<ConditionAction>
|
||||||
@@ -26,7 +24,10 @@
|
|||||||
<ComparisonCondition LeftOperand="{Binding Activated}" RightOperand="True" />
|
<ComparisonCondition LeftOperand="{Binding Activated}" RightOperand="True" />
|
||||||
</ConditionalExpression>
|
</ConditionalExpression>
|
||||||
</ConditionAction.Condition>
|
</ConditionAction.Condition>
|
||||||
<InvokeCommandAction Command="{Binding InvokeCommand}" />
|
<NavigateAction Region="Left" Route="ContentItemCollection">
|
||||||
|
<Parameter Key="Filter" Value="{Binding Filter}" />
|
||||||
|
<Parameter Key="Transition" Value="FromRight" />
|
||||||
|
</NavigateAction>
|
||||||
</ConditionAction>
|
</ConditionAction>
|
||||||
</DataTriggerBehavior>
|
</DataTriggerBehavior>
|
||||||
</Interaction.Behaviors>
|
</Interaction.Behaviors>
|
||||||
|
|||||||
@@ -87,11 +87,15 @@ public partial class App : Application
|
|||||||
services.AddScoped<ContainerViewModelConfiguration>();
|
services.AddScoped<ContainerViewModelConfiguration>();
|
||||||
|
|
||||||
services.AddTemplate<ContainerViewModel, ContainerView>("Container");
|
services.AddTemplate<ContainerViewModel, ContainerView>("Container");
|
||||||
services.AddHandler<AggerateContainerViewModelHandler>();
|
services.AddTemplate<ContainerItemCollectionViewModel, ContainerItemCollectionView>("ContentItemCollection");
|
||||||
|
|
||||||
services.AddTemplate<SearchContainerActionViewModel, SearchContainerActionView>();
|
services.AddTemplate<SearchContainerActionViewModel, SearchContainerActionView>();
|
||||||
services.AddTemplate<ContainerHeaderViewModel, ContainerHeaderView>("ContainerHeader");
|
services.AddTemplate<ContainerHeaderViewModel, ContainerHeaderView>("ContainerHeader");
|
||||||
|
|
||||||
services.AddTemplate<CreateItemActionViewModel, CreateItemActionView>();
|
services.AddTemplate<CreateItemActionViewModel, CreateItemActionView>();
|
||||||
|
services.AddTemplate<ContainerCategoryCollectionViewModel, ContainerCategoryCollectionView>("ContainerItemCategoryCollection");
|
||||||
|
|
||||||
|
services.AddHandler<AggerateContainerItemViewModelHandler>();
|
||||||
|
|
||||||
services.AddTemplate<ItemNavigationViewModel, ItemNavigationView>();
|
services.AddTemplate<ItemNavigationViewModel, ItemNavigationView>();
|
||||||
services.AddTemplate<ItemViewModel, ItemView>("Item");
|
services.AddTemplate<ItemViewModel, ItemView>("Item");
|
||||||
@@ -109,7 +113,7 @@ public partial class App : Application
|
|||||||
|
|
||||||
services.AddTemplate<ItemHeaderViewModel, ItemHeaderView>();
|
services.AddTemplate<ItemHeaderViewModel, ItemHeaderView>();
|
||||||
services.AddTemplate<ItemContentViewModel, ItemContentView>();
|
services.AddTemplate<ItemContentViewModel, ItemContentView>();
|
||||||
services.AddTemplate<AddItemContentNavigationViewModel, AddItemContentNavigationView>();
|
services.AddTemplate<AddItemNavigationViewModel, AddItemNavigationView>();
|
||||||
|
|
||||||
services.AddScoped<IValueStore<Item>, ValueStore<Item>>();
|
services.AddScoped<IValueStore<Item>, ValueStore<Item>>();
|
||||||
|
|
||||||
|
|||||||
@@ -15,9 +15,7 @@
|
|||||||
</ConditionalExpression>
|
</ConditionalExpression>
|
||||||
</ConditionAction.Condition>
|
</ConditionAction.Condition>
|
||||||
<NavigateAction Region="Main" Route="Container">
|
<NavigateAction Region="Main" Route="Container">
|
||||||
<NavigateAction.ParameterBindings>
|
<Parameter Key="Filter" Value="{Binding Filter}" />
|
||||||
<ParameterBinding Key="Filter" Value="{Binding Filter}" />
|
|
||||||
</NavigateAction.ParameterBindings>
|
|
||||||
</NavigateAction>
|
</NavigateAction>
|
||||||
</ConditionAction>
|
</ConditionAction>
|
||||||
<ConditionAction>
|
<ConditionAction>
|
||||||
@@ -26,7 +24,9 @@
|
|||||||
<ComparisonCondition LeftOperand="{Binding Activated}" RightOperand="True" />
|
<ComparisonCondition LeftOperand="{Binding Activated}" RightOperand="True" />
|
||||||
</ConditionalExpression>
|
</ConditionalExpression>
|
||||||
</ConditionAction.Condition>
|
</ConditionAction.Condition>
|
||||||
<InvokeCommandAction Command="{Binding InvokeCommand}" />
|
<NavigateAction Region="Left" Route="ContentItemCollection">
|
||||||
|
<Parameter Key="Filter" Value="{Binding Filter}" />
|
||||||
|
</NavigateAction>
|
||||||
</ConditionAction>
|
</ConditionAction>
|
||||||
</DataTriggerBehavior>
|
</DataTriggerBehavior>
|
||||||
</Interaction.Behaviors>
|
</Interaction.Behaviors>
|
||||||
|
|||||||
@@ -40,8 +40,14 @@
|
|||||||
<ProjectReference Include="..\Toolkit\Toolkit.UI.Controls.Avalonia\Toolkit.UI.Controls.Avalonia.csproj" />
|
<ProjectReference Include="..\Toolkit\Toolkit.UI.Controls.Avalonia\Toolkit.UI.Controls.Avalonia.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Update="AddItemContentNavigationViewModel.axaml.cs">
|
<Compile Update="AddItemNavigationView.axaml.cs">
|
||||||
<DependentUpon>AddItemContentNavigationViewModel.axaml</DependentUpon>
|
<DependentUpon>AddItemNavigationView.axaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Update="ContainerCategoryCollectionView.axaml.cs">
|
||||||
|
<DependentUpon>ContainerCategoryCollectionView.axaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Update="ContainerItemCollectionView.axaml.cs">
|
||||||
|
<DependentUpon>ContainerItemCollectionView.axaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Update="CreateItemActionView.axaml.cs">
|
<Compile Update="CreateItemActionView.axaml.cs">
|
||||||
<DependentUpon>CreateItemActionView.axaml</DependentUpon>
|
<DependentUpon>CreateItemActionView.axaml</DependentUpon>
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<UserControl
|
||||||
|
x:Class="Bitvault.Avalonia.ContainerCategoryCollectionView"
|
||||||
|
xmlns="https://github.com/avaloniaui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:vm="using:Bitvault"
|
||||||
|
x:DataType="vm:ContainerCategoryCollectionViewModel">
|
||||||
|
<ListBox
|
||||||
|
Margin="2,-1,0,0"
|
||||||
|
AutoScrollToSelectedItem="True"
|
||||||
|
ItemTemplate="{ReflectionBinding Template}"
|
||||||
|
ItemsSource="{Binding}"
|
||||||
|
SelectedItem="{Binding SelectedItem, Mode=TwoWay}"
|
||||||
|
SelectionMode="Single">
|
||||||
|
<ListBox.Styles>
|
||||||
|
<Style Selector="ListBoxItem">
|
||||||
|
<Setter Property="IsSelected" Value="{ReflectionBinding Selected, Mode=TwoWay}" />
|
||||||
|
</Style>
|
||||||
|
</ListBox.Styles>
|
||||||
|
</ListBox>
|
||||||
|
</UserControl>
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using Avalonia.Controls;
|
||||||
|
using FluentAvalonia.UI.Media.Animation;
|
||||||
|
using Toolkit.UI.Avalonia;
|
||||||
|
|
||||||
|
namespace Bitvault.Avalonia;
|
||||||
|
|
||||||
|
public partial class ContainerCategoryCollectionView :
|
||||||
|
UserControl
|
||||||
|
{
|
||||||
|
public ContainerCategoryCollectionView() =>
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<UserControl
|
||||||
|
x:Class="Bitvault.Avalonia.ContainerItemCollectionView"
|
||||||
|
xmlns="https://github.com/avaloniaui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:vm="using:Bitvault"
|
||||||
|
x:DataType="vm:ContainerItemCollectionViewModel">
|
||||||
|
<ListBox
|
||||||
|
Margin="2,-1,0,0"
|
||||||
|
AutoScrollToSelectedItem="True"
|
||||||
|
ItemTemplate="{ReflectionBinding Template}"
|
||||||
|
ItemsSource="{Binding}"
|
||||||
|
SelectedItem="{Binding SelectedItem, Mode=TwoWay}"
|
||||||
|
SelectionMode="Single">
|
||||||
|
<ListBox.Styles>
|
||||||
|
<Style Selector="ListBoxItem">
|
||||||
|
<Setter Property="IsSelected" Value="{ReflectionBinding Selected, Mode=TwoWay}" />
|
||||||
|
</Style>
|
||||||
|
</ListBox.Styles>
|
||||||
|
</ListBox>
|
||||||
|
</UserControl>
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
using Avalonia.Controls;
|
||||||
|
|
||||||
|
namespace Bitvault.Avalonia;
|
||||||
|
|
||||||
|
public partial class ContainerItemCollectionView :
|
||||||
|
UserControl
|
||||||
|
{
|
||||||
|
public ContainerItemCollectionView() =>
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
@@ -22,21 +22,17 @@
|
|||||||
</Interaction.Behaviors>
|
</Interaction.Behaviors>
|
||||||
</ContentControl>
|
</ContentControl>
|
||||||
</Grid>
|
</Grid>
|
||||||
<ListBox
|
<Frame Grid.Row="1" Grid.Column="0">
|
||||||
Grid.Row="1"
|
<Interaction.Behaviors>
|
||||||
Grid.Column="0"
|
<AttachedBehaviour>
|
||||||
Margin="2,-1,0,0"
|
<NavigateRegionAction Name="Left">
|
||||||
AutoScrollToSelectedItem="True"
|
<NavigateAction Region="Left" Route="ContentItemCollection">
|
||||||
ItemTemplate="{ReflectionBinding Template}"
|
<Parameter Key="Filter" Value="{Binding Filter}" />
|
||||||
ItemsSource="{Binding}"
|
</NavigateAction>
|
||||||
SelectedItem="{Binding SelectedItem, Mode=TwoWay}"
|
</NavigateRegionAction>
|
||||||
SelectionMode="Single">
|
</AttachedBehaviour>
|
||||||
<ListBox.Styles>
|
</Interaction.Behaviors>
|
||||||
<Style Selector="ListBoxItem">
|
</Frame>
|
||||||
<Setter Property="IsSelected" Value="{ReflectionBinding Selected, Mode=TwoWay}" />
|
|
||||||
</Style>
|
|
||||||
</ListBox.Styles>
|
|
||||||
</ListBox>
|
|
||||||
<GridSplitter
|
<GridSplitter
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
@@ -64,7 +60,7 @@
|
|||||||
</Interaction.Behaviors>
|
</Interaction.Behaviors>
|
||||||
</ContentControl>
|
</ContentControl>
|
||||||
</Border>
|
</Border>
|
||||||
<ContentControl x:Name="Content" Grid.Row="1">
|
<ContentControl Grid.Row="1">
|
||||||
<Interaction.Behaviors>
|
<Interaction.Behaviors>
|
||||||
<AttachedBehaviour>
|
<AttachedBehaviour>
|
||||||
<NavigateRegionAction Name="{Binding Named, StringFormat='{}{0}:Content'}" />
|
<NavigateRegionAction Name="{Binding Named, StringFormat='{}{0}:Content'}" />
|
||||||
|
|||||||
@@ -28,13 +28,8 @@
|
|||||||
</Grid>
|
</Grid>
|
||||||
<Interaction.Behaviors>
|
<Interaction.Behaviors>
|
||||||
<EventTriggerBehavior EventName="Click">
|
<EventTriggerBehavior EventName="Click">
|
||||||
<NavigateAction
|
<NavigateAction Region="Left" Route="ContainerItemCategoryCollection">
|
||||||
Region="{Binding Named, StringFormat='{}{0}:Content'}"
|
<Parameter Key="Transition" Value="FromRight" />
|
||||||
Route="Item"
|
|
||||||
Scope="new">
|
|
||||||
<NavigateAction.ParameterBindings>
|
|
||||||
<ParameterBinding Key="Immutable" Value="{x:False}" />
|
|
||||||
</NavigateAction.ParameterBindings>
|
|
||||||
</NavigateAction>
|
</NavigateAction>
|
||||||
</EventTriggerBehavior>
|
</EventTriggerBehavior>
|
||||||
</Interaction.Behaviors>
|
</Interaction.Behaviors>
|
||||||
|
|||||||
@@ -20,12 +20,10 @@
|
|||||||
Region="{Binding Named, StringFormat='{}{0}:Content'}"
|
Region="{Binding Named, StringFormat='{}{0}:Content'}"
|
||||||
Route="Item"
|
Route="Item"
|
||||||
Scope="self">
|
Scope="self">
|
||||||
<NavigateAction.ParameterBindings>
|
<Parameter Key="Name" Value="{Binding Name}" />
|
||||||
<ParameterBinding Key="Name" Value="{Binding Name}" />
|
<Parameter Key="Immutable" Value="{x:True}" />
|
||||||
<ParameterBinding Key="Immutable" Value="{x:True}" />
|
<Parameter Key="Archived" Value="{Binding Archived}" />
|
||||||
<ParameterBinding Key="Archived" Value="{Binding Archived}" />
|
<Parameter Key="Favourite" Value="{Binding Favourite}" />
|
||||||
<ParameterBinding Key="Favourite" Value="{Binding Favourite}" />
|
|
||||||
</NavigateAction.ParameterBindings>
|
|
||||||
</NavigateAction>
|
</NavigateAction>
|
||||||
</ConditionAction>
|
</ConditionAction>
|
||||||
</AttachedBehaviour>
|
</AttachedBehaviour>
|
||||||
@@ -34,12 +32,10 @@
|
|||||||
Region="{Binding Named, StringFormat='{}{0}:Content'}"
|
Region="{Binding Named, StringFormat='{}{0}:Content'}"
|
||||||
Route="Item"
|
Route="Item"
|
||||||
Scope="self">
|
Scope="self">
|
||||||
<NavigateAction.ParameterBindings>
|
<Parameter Key="Name" Value="{Binding Name}" />
|
||||||
<ParameterBinding Key="Name" Value="{Binding Name}" />
|
<Parameter Key="Immutable" Value="{x:True}" />
|
||||||
<ParameterBinding Key="Immutable" Value="{x:True}" />
|
<Parameter Key="Archived" Value="{Binding Archived}" />
|
||||||
<ParameterBinding Key="Archived" Value="{Binding Archived}" />
|
<Parameter Key="Favourite" Value="{Binding Favourite}" />
|
||||||
<ParameterBinding Key="Favourite" Value="{Binding Favourite}" />
|
|
||||||
</NavigateAction.ParameterBindings>
|
|
||||||
</NavigateAction>
|
</NavigateAction>
|
||||||
</DataTriggerBehavior>
|
</DataTriggerBehavior>
|
||||||
</Interaction.Behaviors>
|
</Interaction.Behaviors>
|
||||||
|
|||||||
@@ -15,9 +15,7 @@
|
|||||||
</ConditionalExpression>
|
</ConditionalExpression>
|
||||||
</ConditionAction.Condition>
|
</ConditionAction.Condition>
|
||||||
<NavigateAction Region="Main" Route="Container">
|
<NavigateAction Region="Main" Route="Container">
|
||||||
<NavigateAction.ParameterBindings>
|
<Parameter Key="Filter" Value="{Binding Filter}" />
|
||||||
<ParameterBinding Key="Filter" Value="{Binding Filter}" />
|
|
||||||
</NavigateAction.ParameterBindings>
|
|
||||||
</NavigateAction>
|
</NavigateAction>
|
||||||
</ConditionAction>
|
</ConditionAction>
|
||||||
<ConditionAction>
|
<ConditionAction>
|
||||||
@@ -26,7 +24,9 @@
|
|||||||
<ComparisonCondition LeftOperand="{Binding Activated}" RightOperand="True" />
|
<ComparisonCondition LeftOperand="{Binding Activated}" RightOperand="True" />
|
||||||
</ConditionalExpression>
|
</ConditionalExpression>
|
||||||
</ConditionAction.Condition>
|
</ConditionAction.Condition>
|
||||||
<InvokeCommandAction Command="{Binding InvokeCommand}" />
|
<NavigateAction Region="Left" Route="ContentItemCollection">
|
||||||
|
<Parameter Key="Filter" Value="{Binding Filter}" />
|
||||||
|
</NavigateAction>
|
||||||
</ConditionAction>
|
</ConditionAction>
|
||||||
</DataTriggerBehavior>
|
</DataTriggerBehavior>
|
||||||
</Interaction.Behaviors>
|
</Interaction.Behaviors>
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
using Toolkit.Foundation;
|
|
||||||
|
|
||||||
namespace Bitvault;
|
|
||||||
|
|
||||||
public partial class AddItemContentNavigationViewModel : Observable,
|
|
||||||
IItemEntryViewModel
|
|
||||||
{
|
|
||||||
public AddItemContentNavigationViewModel(IServiceProvider provider,
|
|
||||||
IServiceFactory factory,
|
|
||||||
IMediator mediator,
|
|
||||||
IPublisher publisher,
|
|
||||||
ISubscription subscriber,
|
|
||||||
IDisposer disposer) : base(provider, factory, mediator, publisher, subscriber, disposer)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
using Toolkit.Foundation;
|
||||||
|
|
||||||
|
namespace Bitvault;
|
||||||
|
|
||||||
|
public partial class AddItemNavigationViewModel(IServiceProvider provider,
|
||||||
|
IServiceFactory factory,
|
||||||
|
IMediator mediator,
|
||||||
|
IPublisher publisher,
|
||||||
|
ISubscription subscriber,
|
||||||
|
IDisposer disposer) : Observable(provider, factory, mediator, publisher, subscriber, disposer),
|
||||||
|
IItemEntryViewModel;
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
using Toolkit.Foundation;
|
||||||
|
|
||||||
|
namespace Bitvault;
|
||||||
|
|
||||||
|
public class AggerateContainerCategoryViewModelHandler(IServiceFactory serviceFactory,
|
||||||
|
IPublisher publisher) :
|
||||||
|
INotificationHandler<AggerateEventArgs<ItemNavigationViewModel,
|
||||||
|
ContainerViewModelConfiguration>>
|
||||||
|
{
|
||||||
|
public Task Handle(AggerateEventArgs<ItemNavigationViewModel,
|
||||||
|
ContainerViewModelConfiguration> args)
|
||||||
|
{
|
||||||
|
if (serviceFactory.Create<ItemNavigationViewModel>()
|
||||||
|
is ItemNavigationViewModel viewModel)
|
||||||
|
{
|
||||||
|
publisher.Publish(Create.As(viewModel), nameof(ContainerCategoryCollectionViewModel));
|
||||||
|
}
|
||||||
|
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
}
|
||||||
+4
-4
@@ -3,11 +3,12 @@ using Toolkit.Foundation;
|
|||||||
|
|
||||||
namespace Bitvault;
|
namespace Bitvault;
|
||||||
|
|
||||||
public class AggerateContainerViewModelHandler(IMediator mediator,
|
public class AggerateContainerItemViewModelHandler(IMediator mediator,
|
||||||
IServiceProvider serviceProvider,
|
IServiceProvider serviceProvider,
|
||||||
ICache<Item> cache,
|
ICache<Item> cache,
|
||||||
IPublisher publisher) :
|
IPublisher publisher) :
|
||||||
INotificationHandler<AggerateEventArgs<ItemNavigationViewModel, ContainerViewModelConfiguration>>
|
INotificationHandler<AggerateEventArgs<ItemNavigationViewModel,
|
||||||
|
ContainerViewModelConfiguration>>
|
||||||
{
|
{
|
||||||
public async Task Handle(AggerateEventArgs<ItemNavigationViewModel,
|
public async Task Handle(AggerateEventArgs<ItemNavigationViewModel,
|
||||||
ContainerViewModelConfiguration> args)
|
ContainerViewModelConfiguration> args)
|
||||||
@@ -15,7 +16,6 @@ public class AggerateContainerViewModelHandler(IMediator mediator,
|
|||||||
if (args.Options is ContainerViewModelConfiguration configuration)
|
if (args.Options is ContainerViewModelConfiguration configuration)
|
||||||
{
|
{
|
||||||
cache.Clear();
|
cache.Clear();
|
||||||
var dd = cache;
|
|
||||||
bool selected = true;
|
bool selected = true;
|
||||||
|
|
||||||
if (await mediator.Handle<RequestEventArgs<QueryContainerConfiguration>,
|
if (await mediator.Handle<RequestEventArgs<QueryContainerConfiguration>,
|
||||||
@@ -37,7 +37,7 @@ public class AggerateContainerViewModelHandler(IMediator mediator,
|
|||||||
valueStore.Set(item);
|
valueStore.Set(item);
|
||||||
|
|
||||||
cache.Add(item);
|
cache.Add(item);
|
||||||
publisher.Publish(Create.As(viewModel), nameof(ContainerViewModel));
|
publisher.Publish(Create.As(viewModel), nameof(ContainerItemCollectionViewModel));
|
||||||
}
|
}
|
||||||
|
|
||||||
selected = false;
|
selected = false;
|
||||||
@@ -2,10 +2,7 @@
|
|||||||
|
|
||||||
namespace Bitvault;
|
namespace Bitvault;
|
||||||
|
|
||||||
public class CommandCollection :
|
public class CommandCollection(IList<IDisposable> list) :
|
||||||
ReadOnlyCollection<IDisposable>
|
ReadOnlyCollection<IDisposable>(list)
|
||||||
{
|
{
|
||||||
public CommandCollection(IList<IDisposable> list) : base(list)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
using Toolkit.Foundation;
|
||||||
|
|
||||||
|
namespace Bitvault;
|
||||||
|
|
||||||
|
[Aggerate(nameof(ContainerCategoryCollectionViewModel))]
|
||||||
|
public partial class ContainerCategoryCollectionViewModel :
|
||||||
|
ObservableCollection<ItemNavigationViewModel>
|
||||||
|
{
|
||||||
|
public ContainerCategoryCollectionViewModel(IServiceProvider provider,
|
||||||
|
IServiceFactory factory,
|
||||||
|
IMediator mediator,
|
||||||
|
IPublisher publisher,
|
||||||
|
ISubscription subscriber,
|
||||||
|
IDisposer disposer) : base(provider, factory, mediator, publisher, subscriber, disposer)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
using Toolkit.Foundation;
|
||||||
|
|
||||||
|
namespace Bitvault;
|
||||||
|
|
||||||
|
[Aggerate(nameof(ContainerItemCollectionViewModel))]
|
||||||
|
public partial class ContainerItemCollectionViewModel :
|
||||||
|
ObservableCollection<ItemNavigationViewModel>,
|
||||||
|
INotificationHandler<NotifyEventArgs<Filter>>,
|
||||||
|
INotificationHandler<NotifyEventArgs<Search>>
|
||||||
|
{
|
||||||
|
private ContainerViewModelConfiguration configuration;
|
||||||
|
|
||||||
|
public ContainerItemCollectionViewModel(IServiceProvider provider,
|
||||||
|
IServiceFactory factory,
|
||||||
|
IMediator mediator,
|
||||||
|
IPublisher publisher,
|
||||||
|
ISubscription subscriber,
|
||||||
|
IDisposer disposer,
|
||||||
|
IContentTemplate template,
|
||||||
|
ContainerViewModelConfiguration configuration,
|
||||||
|
string? filter = null) : base(provider, factory, mediator, publisher, subscriber, disposer)
|
||||||
|
{
|
||||||
|
Template = template;
|
||||||
|
this.configuration = configuration with { Filter = filter };
|
||||||
|
}
|
||||||
|
|
||||||
|
public IContentTemplate Template { get; set; }
|
||||||
|
|
||||||
|
public Task Handle(NotifyEventArgs<Filter> args)
|
||||||
|
{
|
||||||
|
if (args.Value is Filter filter)
|
||||||
|
{
|
||||||
|
configuration = configuration with { Filter = filter.Value };
|
||||||
|
BeginAggregation();
|
||||||
|
}
|
||||||
|
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task Handle(NotifyEventArgs<Search> args)
|
||||||
|
{
|
||||||
|
if (args.Value is Search search)
|
||||||
|
{
|
||||||
|
configuration = configuration with { Query = search.Value };
|
||||||
|
BeginAggregation();
|
||||||
|
}
|
||||||
|
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override IAggerate OnPrepareAggregation(object? key) =>
|
||||||
|
Aggerate.With<ItemNavigationViewModel, ContainerViewModelConfiguration>(configuration)
|
||||||
|
with { Key = key };
|
||||||
|
}
|
||||||
@@ -3,55 +3,25 @@ using Toolkit.Foundation;
|
|||||||
|
|
||||||
namespace Bitvault;
|
namespace Bitvault;
|
||||||
|
|
||||||
[Aggerate(nameof(ContainerViewModel))]
|
public partial class ContainerViewModel :
|
||||||
public partial class ContainerViewModel : ObservableCollection<ItemNavigationViewModel>,
|
Observable
|
||||||
INotificationHandler<NotifyEventArgs<Filter>>,
|
|
||||||
INotificationHandler<NotifyEventArgs<Search>>
|
|
||||||
{
|
{
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
private string named;
|
private string named;
|
||||||
|
|
||||||
|
[ObservableProperty]
|
||||||
|
private string filter;
|
||||||
public ContainerViewModel(IServiceProvider provider,
|
public ContainerViewModel(IServiceProvider provider,
|
||||||
IServiceFactory factory,
|
IServiceFactory factory,
|
||||||
IMediator mediator,
|
IMediator mediator,
|
||||||
IPublisher publisher,
|
IPublisher publisher,
|
||||||
ISubscription subscriber,
|
ISubscription subscriber,
|
||||||
IDisposer disposer,
|
IDisposer disposer,
|
||||||
IContentTemplate template,
|
|
||||||
ContainerViewModelConfiguration configuration,
|
|
||||||
NamedComponent named,
|
NamedComponent named,
|
||||||
string? filter = null) : base(provider, factory, mediator, publisher, subscriber, disposer)
|
string filter) : base(provider, factory, mediator, publisher, subscriber, disposer)
|
||||||
{
|
{
|
||||||
Template = template;
|
|
||||||
Named = $"{named}";
|
Named = $"{named}";
|
||||||
|
Filter = filter;
|
||||||
this.configuration = configuration with { Filter = filter };
|
|
||||||
}
|
|
||||||
|
|
||||||
private ContainerViewModelConfiguration configuration;
|
|
||||||
|
|
||||||
public IContentTemplate Template { get; set; }
|
|
||||||
|
|
||||||
public Task Handle(NotifyEventArgs<Filter> args)
|
|
||||||
{
|
|
||||||
if (args.Value is Filter filter)
|
|
||||||
{
|
|
||||||
configuration = configuration with { Filter = filter.Value };
|
|
||||||
BeginAggregation();
|
|
||||||
}
|
|
||||||
|
|
||||||
return Task.CompletedTask;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Task Handle(NotifyEventArgs<Search> args)
|
|
||||||
{
|
|
||||||
if (args.Value is Search search)
|
|
||||||
{
|
|
||||||
configuration = configuration with { Query = search.Value };
|
|
||||||
BeginAggregation();
|
|
||||||
}
|
|
||||||
|
|
||||||
return Task.CompletedTask;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task OnActivated()
|
public override async Task OnActivated()
|
||||||
@@ -65,6 +35,4 @@ public partial class ContainerViewModel : ObservableCollection<ItemNavigationVie
|
|||||||
Publisher.Publish(Deactivated.As<Container>());
|
Publisher.Publish(Deactivated.As<Container>());
|
||||||
await base.OnDeactivated();
|
await base.OnDeactivated();
|
||||||
}
|
}
|
||||||
protected override IAggerate OnPrepareAggregation(object? key) =>
|
|
||||||
Aggerate.With<ItemNavigationViewModel, ContainerViewModelConfiguration>(configuration) with { Key = key };
|
|
||||||
}
|
}
|
||||||
@@ -37,5 +37,5 @@ public partial class FilterContainerNavigationViewModel : Observable,
|
|||||||
|
|
||||||
[RelayCommand]
|
[RelayCommand]
|
||||||
public void Invoke() => Publisher.Publish(Notify.As(new Filter(Filter)),
|
public void Invoke() => Publisher.Publish(Notify.As(new Filter(Filter)),
|
||||||
nameof(ContainerViewModel));
|
nameof(ContainerItemCollectionViewModel));
|
||||||
}
|
}
|
||||||
@@ -18,7 +18,7 @@ public partial class ItemContentViewModel :
|
|||||||
|
|
||||||
if (!immutable)
|
if (!immutable)
|
||||||
{
|
{
|
||||||
Insert<AddItemContentNavigationViewModel>();
|
Insert<AddItemNavigationViewModel>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,5 +17,5 @@ public partial class SearchContainerActionViewModel(IServiceProvider provider,
|
|||||||
|
|
||||||
[RelayCommand]
|
[RelayCommand]
|
||||||
public void Invoke() => Publisher.Publish(Notify.As(new Search(Value)),
|
public void Invoke() => Publisher.Publish(Notify.As(new Search(Value)),
|
||||||
nameof(ContainerViewModel));
|
nameof(ContainerItemCollectionViewModel));
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user