wip
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia.Desktop" Version="11.1.0-beta1" />
|
||||
<PackageReference Include="Avalonia.Desktop" Version="11.1.0-beta2" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Bitvault.Avalonia\Bitvault.Avalonia.csproj" />
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
<UserControl
|
||||
x:Class="Bitvault.Avalonia.AddVaultContentActionView"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Button
|
||||
Grid.Column="1"
|
||||
Width="{StaticResource ButtonWidth}"
|
||||
Height="{StaticResource ButtonHeight}"
|
||||
VerticalAlignment="Center"
|
||||
BorderThickness="0"
|
||||
Content=""
|
||||
FontFamily="{DynamicResource SymbolThemeFontFamily}"
|
||||
FontSize="16"
|
||||
ToolTip.Tip="Add item">
|
||||
<Interaction.Behaviors>
|
||||
<EventTriggerBehavior EventName="Click">
|
||||
<NavigateAction Context="Content" Route="AddVaultContent" />
|
||||
</EventTriggerBehavior>
|
||||
</Interaction.Behaviors>
|
||||
</Button>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,8 @@
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace Bitvault.Avalonia;
|
||||
|
||||
public partial class AddVaultContentActionView : UserControl
|
||||
{
|
||||
public AddVaultContentActionView() => InitializeComponent();
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<UserControl
|
||||
x:Class="Bitvault.Avalonia.AddVaultContentView"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
Add vault content placeholder
|
||||
</UserControl>
|
||||
@@ -0,0 +1,8 @@
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace Bitvault.Avalonia;
|
||||
|
||||
public partial class AddVaultContentView : UserControl
|
||||
{
|
||||
public AddVaultContentView() => InitializeComponent();
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
xmlns:vm="using:Bitvault"
|
||||
x:DataType="vm:AllNavigationViewModel"
|
||||
Content="All"
|
||||
IsSelected="{Binding Selected, Mode=TwoWay}">
|
||||
IsSelected="{Binding Selected}">
|
||||
<Interaction.Behaviors>
|
||||
<DataTriggerBehavior Binding="{Binding Selected}" Value="True">
|
||||
<ConditionAction>
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:ui="using:FluentAvalonia.UI.Controls"
|
||||
RequestedThemeVariant="Dark">
|
||||
RequestedThemeVariant="Default">
|
||||
<Application.Styles>
|
||||
<ThemeResources />
|
||||
<ThemeResources PreferUserAccentColor="True" />
|
||||
<Style Selector="ui|SettingsExpanderItem">
|
||||
<Style Selector="^ /template/ Expander#Expander">
|
||||
<Setter Property="IsVisible" Value="False" />
|
||||
|
||||
@@ -72,9 +72,13 @@ public partial class App : Application
|
||||
services.AddTemplate<VaultViewModel, VaultView>("Vault");
|
||||
services.AddHandler<VaultViewModelHandler>();
|
||||
|
||||
services.AddTemplate<LockerNavigationViewModel, LockerNavigationView>();
|
||||
services.AddTemplate<VaultSearchHeaderViewModel, VaultSearchHeaderView>("VaultSearchHeader");
|
||||
services.AddTemplate<VaultHeaderViewModel, VaultHeaderView>("VaultHeader");
|
||||
services.AddTemplate<AddVaultContentActionViewModel, AddVaultContentActionView>();
|
||||
services.AddTemplate<AddVaultContentViewModel, AddVaultContentView>("AddVaultContent");
|
||||
services.AddTemplate<VaultContentViewModel, VaultContentView>("VaultContent");
|
||||
|
||||
services.AddTemplate<VaultCommandViewModel, VaultCommandView>("VaultCommands");
|
||||
services.AddTemplate<VaultContentNavigationViewModel, VaultContentNavigationView>();
|
||||
});
|
||||
})!);
|
||||
|
||||
|
||||
@@ -12,22 +12,25 @@
|
||||
<DefineConstants>$(DefineConstants);ENABLE_XAML_HOT_RELOAD</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Condition="$(DefineConstants.Contains(ENABLE_XAML_HOT_RELOAD))" Include="Avalonia.Markup.Xaml.Loader" Version="11.1.0-beta1" />
|
||||
<PackageReference Condition="$(DefineConstants.Contains(ENABLE_XAML_HOT_RELOAD))" Include="HotAvalonia" Version="1.1.0" />
|
||||
<PackageReference Include="HotAvalonia.Extensions" Version="1.1.0" PrivateAssets="All" />
|
||||
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.1.0-beta1" />
|
||||
<Compile Remove="VaultContentNavigationView.axaml.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Condition="$(DefineConstants.Contains(ENABLE_XAML_HOT_RELOAD))" Include="Avalonia.Markup.Xaml.Loader" Version="11.1.0-beta2" />
|
||||
<PackageReference Condition="$(DefineConstants.Contains(ENABLE_XAML_HOT_RELOAD))" Include="HotAvalonia" Version="1.1.1" />
|
||||
<PackageReference Include="HotAvalonia.Extensions" Version="1.1.1" PrivateAssets="All" />
|
||||
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.1.0-beta2" />
|
||||
<PackageReference Include="Avalonia.Labs.Controls" Version="11.0.10.1" />
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
|
||||
<PackageReference Include="FluentAvaloniaUI" Version="2.1.0-preview2" />
|
||||
<PackageReference Include="FluentAvaloniaUI" Version="2.1.0-preview1" />
|
||||
<PackageReference Include="System.Reactive" Version="6.0.1-preview.1" />
|
||||
<PackageReference Include="Avalonia.Xaml.Behaviors" Version="11.1.0-beta1" />
|
||||
<PackageReference Include="Avalonia.Xaml.Behaviors" Version="11.1.0-beta2.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.0-preview.3.24172.9" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.0-preview.3.24172.4">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
|
||||
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.1.0-beta1" />
|
||||
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.1.0-beta2" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Bitvault\Bitvault.csproj" />
|
||||
@@ -37,12 +40,18 @@
|
||||
<ProjectReference Include="..\Toolkit\Toolkit.UI.Controls.Avalonia\Toolkit.UI.Controls.Avalonia.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Update="AddVaultContentActionView.axaml.cs">
|
||||
<DependentUpon>AddVaultContentActionView.axaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="OpenView.axaml.cs">
|
||||
<DependentUpon>OpenView.axaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="ManageNavigationView.axaml.cs">
|
||||
<DependentUpon>ManageNavigationView.axaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="VaultHeaderView.axaml.cs">
|
||||
<DependentUpon>VaultHeaderView.axaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="VaultNavigationView.axaml.cs">
|
||||
<DependentUpon>VaultNavigationView.axaml</DependentUpon>
|
||||
</Compile>
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
<ListBoxItem
|
||||
x:Class="Bitvault.Avalonia.LockerNavigationView"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
mc:Ignorable="d">
|
||||
Welcome to Avalonia!
|
||||
</ListBoxItem>
|
||||
@@ -0,0 +1,8 @@
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace Bitvault.Avalonia;
|
||||
|
||||
public partial class VaultContentNavigationView : ListBoxItem
|
||||
{
|
||||
public VaultContentNavigationView() => InitializeComponent();
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<UserControl
|
||||
x:Class="Bitvault.Avalonia.VaultContentView"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
Vault content placeholder
|
||||
</UserControl>
|
||||
@@ -0,0 +1,8 @@
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace Bitvault.Avalonia;
|
||||
|
||||
public partial class VaultContentView : UserControl
|
||||
{
|
||||
public VaultContentView() => InitializeComponent();
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<UserControl
|
||||
x:Class="Bitvault.Avalonia.VaultHeaderView"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="using:Bitvault"
|
||||
x:DataType="vm:VaultHeaderViewModel">
|
||||
<Grid ColumnDefinitions="*,Auto">
|
||||
<TextBlock
|
||||
Grid.Column="0"
|
||||
Margin="16,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding Value}"
|
||||
Theme="{DynamicResource BodyStrongTextBlockStyle}" />
|
||||
<ItemsControl
|
||||
Grid.Column="1"
|
||||
Margin="0,0,4,0"
|
||||
VerticalAlignment="Center"
|
||||
ItemTemplate="{ReflectionBinding Template}"
|
||||
ItemsSource="{Binding}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Orientation="Horizontal" />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
</ItemsControl>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,8 @@
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace Bitvault.Avalonia;
|
||||
|
||||
public partial class VaultHeaderView : UserControl
|
||||
{
|
||||
public VaultHeaderView() => InitializeComponent();
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<UserControl
|
||||
x:Class="Bitvault.Avalonia.VaultSearchHeaderView"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<AutoCompleteBox VerticalAlignment="Center" />
|
||||
</UserControl>
|
||||
+2
-2
@@ -2,9 +2,9 @@ using Avalonia.Controls;
|
||||
|
||||
namespace Bitvault.Avalonia
|
||||
{
|
||||
public partial class LockerNavigationView : UserControl
|
||||
public partial class VaultSearchHeaderView : UserControl
|
||||
{
|
||||
public LockerNavigationView()
|
||||
public VaultSearchHeaderView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
@@ -11,29 +11,27 @@
|
||||
<SolidColorBrush x:Key="ButtonBackgroundPointerOver" Color="{DynamicResource SubtleFillColorSecondary}" />
|
||||
<SolidColorBrush x:Key="ButtonBackgroundPressed" Color="{DynamicResource SubtleFillColorTertiary}" />
|
||||
</UserControl.Resources>
|
||||
<Grid ColumnDefinitions="1*,Auto,2*">
|
||||
<Grid Grid.Column="0" RowDefinitions="Auto,*">
|
||||
<Grid
|
||||
Height="40"
|
||||
Margin="0,4,0,0"
|
||||
ColumnDefinitions="*,Auto">
|
||||
<TextBlock Grid.Column="0" Text="{Binding Filter}" />
|
||||
<Button
|
||||
Grid.Column="1"
|
||||
Width="{StaticResource ButtonWidth}"
|
||||
Height="{StaticResource ButtonHeight}"
|
||||
VerticalAlignment="Center"
|
||||
BorderThickness="0"
|
||||
Content=""
|
||||
FontFamily="{DynamicResource SymbolThemeFontFamily}"
|
||||
FontSize="16" />
|
||||
</Grid>
|
||||
<ListBox
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Margin="0,-1,0,0"
|
||||
ItemTemplate="{ReflectionBinding Template}"
|
||||
ItemsSource="{Binding}" />
|
||||
</Grid>
|
||||
<Grid ColumnDefinitions="320,*" RowDefinitions="Auto,*">
|
||||
<ContentControl
|
||||
Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
Height="40"
|
||||
Margin="4,4,0,0">
|
||||
<Interaction.Behaviors>
|
||||
<EventTriggerBehavior EventName="Loaded">
|
||||
<NavigateAction Context="{Binding $self}" Route="VaultHeader" />
|
||||
</EventTriggerBehavior>
|
||||
</Interaction.Behaviors>
|
||||
</ContentControl>
|
||||
<ListBox
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Margin="2,-1,0,0"
|
||||
ItemTemplate="{ReflectionBinding Template}"
|
||||
ItemsSource="{Binding}" />
|
||||
<Frame
|
||||
x:Name="Content"
|
||||
Grid.Row="1"
|
||||
Grid.Column="1" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
@@ -4,6 +4,7 @@ using Toolkit.Foundation;
|
||||
namespace Bitvault.Avalonia;
|
||||
|
||||
[NavigationTarget("Header")]
|
||||
[NavigationTarget("Content")]
|
||||
public partial class VaultView : UserControl
|
||||
{
|
||||
public VaultView() => InitializeComponent();
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
using Toolkit.Foundation;
|
||||
|
||||
namespace Bitvault;
|
||||
|
||||
public partial class AddVaultContentActionViewModel(IServiceProvider provider,
|
||||
IServiceFactory factory,
|
||||
IMediator mediator,
|
||||
IPublisher publisher,
|
||||
ISubscriber subscriber,
|
||||
IDisposer disposer) : ObservableViewModel(provider, factory, mediator, publisher, subscriber, disposer);
|
||||
@@ -0,0 +1,10 @@
|
||||
using Toolkit.Foundation;
|
||||
|
||||
namespace Bitvault;
|
||||
|
||||
public partial class AddVaultContentViewModel(IServiceProvider provider,
|
||||
IServiceFactory factory,
|
||||
IMediator mediator,
|
||||
IPublisher publisher,
|
||||
ISubscriber subscriber,
|
||||
IDisposer disposer) : ObservableViewModel(provider, factory, mediator, publisher, subscriber, disposer);
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Bitvault;
|
||||
|
||||
public record Locker
|
||||
public record Content
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
@@ -38,5 +38,5 @@ public partial class FilterVaultNavigationViewModel : ObservableViewModel,
|
||||
Task.FromResult(Activated = true);
|
||||
|
||||
[RelayCommand]
|
||||
public async Task Invoke() => await Publisher.Publish(Vault.As(new Filter<string>(Filter)), nameof(VaultViewModel));
|
||||
public async Task Invoke() => await Publisher.Publish(Vault.As(new Filter<string>(Filter)));
|
||||
}
|
||||
@@ -3,7 +3,7 @@ using Toolkit.Foundation;
|
||||
|
||||
namespace Bitvault;
|
||||
|
||||
[Notification(nameof(MainViewModel))]
|
||||
[Enumerate(nameof(MainViewModel))]
|
||||
public partial class MainViewModel :
|
||||
ObservableCollectionViewModel<IMainNavigationViewModel>
|
||||
{
|
||||
|
||||
@@ -9,44 +9,4 @@ public partial class ManageNavigationViewModel(IServiceProvider provider,
|
||||
ISubscriber subscriber,
|
||||
IDisposer disposer) :
|
||||
ObservableViewModel(provider, factory, mediator, publisher, subscriber, disposer),
|
||||
IMainNavigationViewModel;
|
||||
|
||||
public partial class VaultCommandViewModel : ObservableCollectionViewModel
|
||||
{
|
||||
public VaultCommandViewModel(IServiceProvider provider,
|
||||
IServiceFactory factory,
|
||||
IMediator mediator,
|
||||
IPublisher publisher,
|
||||
ISubscriber subscriber,
|
||||
IDisposer disposer) : base(provider, factory, mediator, publisher, subscriber, disposer)
|
||||
{
|
||||
Add<SearchVaultCommandViewModel>();
|
||||
Add<CreateLockerCommandViewModel>();
|
||||
}
|
||||
}
|
||||
|
||||
public partial class SearchVaultCommandViewModel :
|
||||
ObservableCollectionViewModel
|
||||
{
|
||||
public SearchVaultCommandViewModel(IServiceProvider provider,
|
||||
IServiceFactory factory,
|
||||
IMediator mediator,
|
||||
IPublisher publisher,
|
||||
ISubscriber subscriber,
|
||||
IDisposer disposer) : base(provider, factory, mediator, publisher, subscriber, disposer)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public partial class CreateLockerCommandViewModel :
|
||||
ObservableCollectionViewModel
|
||||
{
|
||||
public CreateLockerCommandViewModel(IServiceProvider provider,
|
||||
IServiceFactory factory,
|
||||
IMediator mediator,
|
||||
IPublisher publisher,
|
||||
ISubscriber subscriber,
|
||||
IDisposer disposer) : base(provider, factory, mediator, publisher, subscriber, disposer)
|
||||
{
|
||||
}
|
||||
}
|
||||
IMainNavigationViewModel;
|
||||
@@ -0,0 +1,32 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using Toolkit.Foundation;
|
||||
|
||||
namespace Bitvault;
|
||||
|
||||
public partial class VaultContentNavigationViewModel(IServiceProvider provider,
|
||||
IServiceFactory factory,
|
||||
IMediator mediator,
|
||||
IPublisher publisher,
|
||||
ISubscriber subscriber,
|
||||
IDisposer disposer,
|
||||
IContentTemplate template,
|
||||
string name,
|
||||
string description) :
|
||||
ObservableViewModel(provider, factory, mediator, publisher, subscriber, disposer)
|
||||
{
|
||||
[ObservableProperty]
|
||||
private bool selected;
|
||||
|
||||
[ObservableProperty]
|
||||
private string? name = name;
|
||||
|
||||
[ObservableProperty]
|
||||
private string? description = description;
|
||||
|
||||
public IContentTemplate Template { get; set; } = template;
|
||||
|
||||
partial void OnSelectedChanged(bool value)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Bitvault;
|
||||
|
||||
public class LockerNavigationViewModel(IServiceProvider provider,
|
||||
public class VaultContentViewModel(IServiceProvider provider,
|
||||
IServiceFactory factory,
|
||||
IMediator mediator,
|
||||
IPublisher publisher,
|
||||
@@ -9,17 +9,17 @@ public class VaultDbContext(DbContextOptions<VaultDbContext> options) :
|
||||
|
||||
public DbSet<Document> Documents { get; set; }
|
||||
|
||||
public DbSet<Locker> Lockers { get; set; }
|
||||
public DbSet<Content> Items { get; set; }
|
||||
|
||||
public DbSet<Tag> Tags { get; set; }
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.Entity<Locker>()
|
||||
modelBuilder.Entity<Content>()
|
||||
.HasMany(x => x.Tags)
|
||||
.WithOne();
|
||||
|
||||
modelBuilder.Entity<Locker>()
|
||||
modelBuilder.Entity<Content>()
|
||||
.HasMany(x => x.Documents)
|
||||
.WithOne();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
using Toolkit.Foundation;
|
||||
|
||||
namespace Bitvault;
|
||||
|
||||
public partial class VaultHeaderViewModel : ObservableCollectionViewModel<string, IDisposable>,
|
||||
INotificationHandler<Vault<Filter<string>>>
|
||||
{
|
||||
public VaultHeaderViewModel(IServiceProvider provider,
|
||||
IServiceFactory factory,
|
||||
IMediator mediator,
|
||||
IPublisher publisher,
|
||||
ISubscriber subscriber,
|
||||
IDisposer disposer,
|
||||
IContentTemplate template) : base(provider, factory, mediator, publisher, subscriber, disposer)
|
||||
{
|
||||
Template = template;
|
||||
|
||||
Add<AddVaultContentActionViewModel>();
|
||||
}
|
||||
|
||||
public IContentTemplate Template { get; set; }
|
||||
|
||||
public Task Handle(Vault<Filter<string>> args,
|
||||
CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (args.Value is Filter<string> filter)
|
||||
{
|
||||
Value = filter.Value;
|
||||
}
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Bitvault;
|
||||
|
||||
public class LockerViewModel(IServiceProvider provider,
|
||||
public class VaultItemViewModel(IServiceProvider provider,
|
||||
IServiceFactory factory,
|
||||
IMediator mediator,
|
||||
IPublisher publisher,
|
||||
@@ -0,0 +1,10 @@
|
||||
using Toolkit.Foundation;
|
||||
|
||||
namespace Bitvault;
|
||||
|
||||
public partial class VaultSearchHeaderViewModel(IServiceProvider provider,
|
||||
IServiceFactory factory,
|
||||
IMediator mediator,
|
||||
IPublisher publisher,
|
||||
ISubscriber subscriber,
|
||||
IDisposer disposer) : ObservableViewModel<string>(provider, factory, mediator, publisher, subscriber, disposer);
|
||||
@@ -3,7 +3,8 @@ using Toolkit.Foundation;
|
||||
|
||||
namespace Bitvault;
|
||||
|
||||
[Notification(nameof(VaultViewModel))]
|
||||
|
||||
[Enumerate(nameof(VaultViewModel))]
|
||||
public partial class VaultViewModel(IServiceProvider provider,
|
||||
IServiceFactory factory,
|
||||
IMediator mediator,
|
||||
@@ -11,7 +12,7 @@ public partial class VaultViewModel(IServiceProvider provider,
|
||||
ISubscriber subscriber,
|
||||
IDisposer disposer,
|
||||
IContentTemplate template,
|
||||
string? filter = null) : ObservableCollectionViewModel<LockerNavigationViewModel>(provider, factory, mediator, publisher, subscriber, disposer),
|
||||
string? filter = null) : ObservableCollectionViewModel<VaultContentNavigationViewModel>(provider, factory, mediator, publisher, subscriber, disposer),
|
||||
INotificationHandler<Vault<Filter<string>>>
|
||||
{
|
||||
[ObservableProperty]
|
||||
@@ -31,8 +32,8 @@ public partial class VaultViewModel(IServiceProvider provider,
|
||||
await base.Deactivated();
|
||||
}
|
||||
|
||||
protected override IEnumerate CreateEnumeration(object? key) =>
|
||||
Enumerate<LockerNavigationViewModel>.With(new VaultViewModelOptions { Filter = Filter }) with { Key = key };
|
||||
protected override IEnumerate PrepareEnumeration(object? key) =>
|
||||
Enumerate<VaultContentNavigationViewModel>.With(new VaultViewModelOptions { Filter = Filter }) with { Key = key };
|
||||
|
||||
public async Task Handle(Vault<Filter<string>> args,
|
||||
CancellationToken cancellationToken = default)
|
||||
|
||||
@@ -4,18 +4,18 @@ namespace Bitvault;
|
||||
|
||||
public class VaultViewModelHandler(IServiceFactory factory,
|
||||
IPublisher publisher) :
|
||||
INotificationHandler<Enumerate<LockerNavigationViewModel, VaultViewModelOptions>>
|
||||
INotificationHandler<Enumerate<VaultContentNavigationViewModel, VaultViewModelOptions>>
|
||||
{
|
||||
public async Task Handle(Enumerate<LockerNavigationViewModel, VaultViewModelOptions> args,
|
||||
public async Task Handle(Enumerate<VaultContentNavigationViewModel, VaultViewModelOptions> args,
|
||||
CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (args.Options?.Filter is "All")
|
||||
{
|
||||
for (int i = 0; i < 100; i++)
|
||||
{
|
||||
if (factory.Create<LockerNavigationViewModel>() is LockerNavigationViewModel viewModel)
|
||||
if (factory.Create<VaultContentNavigationViewModel>("Name " + i, "Description " + 1) is VaultContentNavigationViewModel viewModel)
|
||||
{
|
||||
await publisher.Publish(new Create<LockerNavigationViewModel>(viewModel),
|
||||
await publisher.Publish(new Create<VaultContentNavigationViewModel>(viewModel),
|
||||
nameof(VaultViewModel), cancellationToken);
|
||||
}
|
||||
}
|
||||
@@ -25,9 +25,9 @@ public class VaultViewModelHandler(IServiceFactory factory,
|
||||
{
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
if (factory.Create<LockerNavigationViewModel>() is LockerNavigationViewModel viewModel)
|
||||
if (factory.Create<VaultContentNavigationViewModel>("Name " + i, "Description " + 1) is VaultContentNavigationViewModel viewModel)
|
||||
{
|
||||
await publisher.Publish(new Create<LockerNavigationViewModel>(viewModel),
|
||||
await publisher.Publish(new Create<VaultContentNavigationViewModel>(viewModel),
|
||||
nameof(VaultViewModel), cancellationToken);
|
||||
}
|
||||
}
|
||||
@@ -35,11 +35,11 @@ public class VaultViewModelHandler(IServiceFactory factory,
|
||||
|
||||
if (args.Options?.Filter is "Archive")
|
||||
{
|
||||
for (int i = 0; i < 100000; i++)
|
||||
for (int i = 0; i < 1000; i++)
|
||||
{
|
||||
if (factory.Create<LockerNavigationViewModel>() is LockerNavigationViewModel viewModel)
|
||||
if (factory.Create<VaultContentNavigationViewModel>("Name " + i, "Description " + 1) is VaultContentNavigationViewModel viewModel)
|
||||
{
|
||||
await publisher.Publish(new Create<LockerNavigationViewModel>(viewModel),
|
||||
await publisher.Publish(new Create<VaultContentNavigationViewModel>(viewModel),
|
||||
nameof(VaultViewModel), cancellationToken);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user