wip
This commit is contained in:
@@ -9,7 +9,7 @@
|
|||||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Avalonia.Desktop" Version="11.1.0-beta1" />
|
<PackageReference Include="Avalonia.Desktop" Version="11.1.0-beta2" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Bitvault.Avalonia\Bitvault.Avalonia.csproj" />
|
<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"
|
xmlns:vm="using:Bitvault"
|
||||||
x:DataType="vm:AllNavigationViewModel"
|
x:DataType="vm:AllNavigationViewModel"
|
||||||
Content="All"
|
Content="All"
|
||||||
IsSelected="{Binding Selected, Mode=TwoWay}">
|
IsSelected="{Binding Selected}">
|
||||||
<Interaction.Behaviors>
|
<Interaction.Behaviors>
|
||||||
<DataTriggerBehavior Binding="{Binding Selected}" Value="True">
|
<DataTriggerBehavior Binding="{Binding Selected}" Value="True">
|
||||||
<ConditionAction>
|
<ConditionAction>
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
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"
|
||||||
xmlns:ui="using:FluentAvalonia.UI.Controls"
|
xmlns:ui="using:FluentAvalonia.UI.Controls"
|
||||||
RequestedThemeVariant="Dark">
|
RequestedThemeVariant="Default">
|
||||||
<Application.Styles>
|
<Application.Styles>
|
||||||
<ThemeResources />
|
<ThemeResources PreferUserAccentColor="True" />
|
||||||
<Style Selector="ui|SettingsExpanderItem">
|
<Style Selector="ui|SettingsExpanderItem">
|
||||||
<Style Selector="^ /template/ Expander#Expander">
|
<Style Selector="^ /template/ Expander#Expander">
|
||||||
<Setter Property="IsVisible" Value="False" />
|
<Setter Property="IsVisible" Value="False" />
|
||||||
|
|||||||
@@ -72,9 +72,13 @@ public partial class App : Application
|
|||||||
services.AddTemplate<VaultViewModel, VaultView>("Vault");
|
services.AddTemplate<VaultViewModel, VaultView>("Vault");
|
||||||
services.AddHandler<VaultViewModelHandler>();
|
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>
|
<DefineConstants>$(DefineConstants);ENABLE_XAML_HOT_RELOAD</DefineConstants>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Condition="$(DefineConstants.Contains(ENABLE_XAML_HOT_RELOAD))" Include="Avalonia.Markup.Xaml.Loader" Version="11.1.0-beta1" />
|
<Compile Remove="VaultContentNavigationView.axaml.cs" />
|
||||||
<PackageReference Condition="$(DefineConstants.Contains(ENABLE_XAML_HOT_RELOAD))" Include="HotAvalonia" Version="1.1.0" />
|
</ItemGroup>
|
||||||
<PackageReference Include="HotAvalonia.Extensions" Version="1.1.0" PrivateAssets="All" />
|
<ItemGroup>
|
||||||
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.1.0-beta1" />
|
<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="Avalonia.Labs.Controls" Version="11.0.10.1" />
|
||||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
|
<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="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.Extensions.Hosting" Version="9.0.0-preview.3.24172.9" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.0-preview.3.24172.4">
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.0-preview.3.24172.4">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
|
<!--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>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Bitvault\Bitvault.csproj" />
|
<ProjectReference Include="..\Bitvault\Bitvault.csproj" />
|
||||||
@@ -37,12 +40,18 @@
|
|||||||
<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="AddVaultContentActionView.axaml.cs">
|
||||||
|
<DependentUpon>AddVaultContentActionView.axaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Update="OpenView.axaml.cs">
|
<Compile Update="OpenView.axaml.cs">
|
||||||
<DependentUpon>OpenView.axaml</DependentUpon>
|
<DependentUpon>OpenView.axaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Update="ManageNavigationView.axaml.cs">
|
<Compile Update="ManageNavigationView.axaml.cs">
|
||||||
<DependentUpon>ManageNavigationView.axaml</DependentUpon>
|
<DependentUpon>ManageNavigationView.axaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Update="VaultHeaderView.axaml.cs">
|
||||||
|
<DependentUpon>VaultHeaderView.axaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Update="VaultNavigationView.axaml.cs">
|
<Compile Update="VaultNavigationView.axaml.cs">
|
||||||
<DependentUpon>VaultNavigationView.axaml</DependentUpon>
|
<DependentUpon>VaultNavigationView.axaml</DependentUpon>
|
||||||
</Compile>
|
</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
|
namespace Bitvault.Avalonia
|
||||||
{
|
{
|
||||||
public partial class LockerNavigationView : UserControl
|
public partial class VaultSearchHeaderView : UserControl
|
||||||
{
|
{
|
||||||
public LockerNavigationView()
|
public VaultSearchHeaderView()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
@@ -11,29 +11,27 @@
|
|||||||
<SolidColorBrush x:Key="ButtonBackgroundPointerOver" Color="{DynamicResource SubtleFillColorSecondary}" />
|
<SolidColorBrush x:Key="ButtonBackgroundPointerOver" Color="{DynamicResource SubtleFillColorSecondary}" />
|
||||||
<SolidColorBrush x:Key="ButtonBackgroundPressed" Color="{DynamicResource SubtleFillColorTertiary}" />
|
<SolidColorBrush x:Key="ButtonBackgroundPressed" Color="{DynamicResource SubtleFillColorTertiary}" />
|
||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
<Grid ColumnDefinitions="1*,Auto,2*">
|
<Grid ColumnDefinitions="320,*" RowDefinitions="Auto,*">
|
||||||
<Grid Grid.Column="0" RowDefinitions="Auto,*">
|
<ContentControl
|
||||||
<Grid
|
Grid.Row="0"
|
||||||
Height="40"
|
Grid.Column="0"
|
||||||
Margin="0,4,0,0"
|
Height="40"
|
||||||
ColumnDefinitions="*,Auto">
|
Margin="4,4,0,0">
|
||||||
<TextBlock Grid.Column="0" Text="{Binding Filter}" />
|
<Interaction.Behaviors>
|
||||||
<Button
|
<EventTriggerBehavior EventName="Loaded">
|
||||||
Grid.Column="1"
|
<NavigateAction Context="{Binding $self}" Route="VaultHeader" />
|
||||||
Width="{StaticResource ButtonWidth}"
|
</EventTriggerBehavior>
|
||||||
Height="{StaticResource ButtonHeight}"
|
</Interaction.Behaviors>
|
||||||
VerticalAlignment="Center"
|
</ContentControl>
|
||||||
BorderThickness="0"
|
<ListBox
|
||||||
Content=""
|
Grid.Row="1"
|
||||||
FontFamily="{DynamicResource SymbolThemeFontFamily}"
|
Grid.Column="0"
|
||||||
FontSize="16" />
|
Margin="2,-1,0,0"
|
||||||
</Grid>
|
ItemTemplate="{ReflectionBinding Template}"
|
||||||
<ListBox
|
ItemsSource="{Binding}" />
|
||||||
Grid.Row="1"
|
<Frame
|
||||||
Grid.Column="0"
|
x:Name="Content"
|
||||||
Margin="0,-1,0,0"
|
Grid.Row="1"
|
||||||
ItemTemplate="{ReflectionBinding Template}"
|
Grid.Column="1" />
|
||||||
ItemsSource="{Binding}" />
|
|
||||||
</Grid>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using Toolkit.Foundation;
|
|||||||
namespace Bitvault.Avalonia;
|
namespace Bitvault.Avalonia;
|
||||||
|
|
||||||
[NavigationTarget("Header")]
|
[NavigationTarget("Header")]
|
||||||
|
[NavigationTarget("Content")]
|
||||||
public partial class VaultView : UserControl
|
public partial class VaultView : UserControl
|
||||||
{
|
{
|
||||||
public VaultView() => InitializeComponent();
|
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;
|
namespace Bitvault;
|
||||||
|
|
||||||
public record Locker
|
public record Content
|
||||||
{
|
{
|
||||||
[Key]
|
[Key]
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
@@ -38,5 +38,5 @@ public partial class FilterVaultNavigationViewModel : ObservableViewModel,
|
|||||||
Task.FromResult(Activated = true);
|
Task.FromResult(Activated = true);
|
||||||
|
|
||||||
[RelayCommand]
|
[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;
|
namespace Bitvault;
|
||||||
|
|
||||||
[Notification(nameof(MainViewModel))]
|
[Enumerate(nameof(MainViewModel))]
|
||||||
public partial class MainViewModel :
|
public partial class MainViewModel :
|
||||||
ObservableCollectionViewModel<IMainNavigationViewModel>
|
ObservableCollectionViewModel<IMainNavigationViewModel>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,44 +9,4 @@ public partial class ManageNavigationViewModel(IServiceProvider provider,
|
|||||||
ISubscriber subscriber,
|
ISubscriber subscriber,
|
||||||
IDisposer disposer) :
|
IDisposer disposer) :
|
||||||
ObservableViewModel(provider, factory, mediator, publisher, subscriber, disposer),
|
ObservableViewModel(provider, factory, mediator, publisher, subscriber, disposer),
|
||||||
IMainNavigationViewModel;
|
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)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -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;
|
namespace Bitvault;
|
||||||
|
|
||||||
public class LockerNavigationViewModel(IServiceProvider provider,
|
public class VaultContentViewModel(IServiceProvider provider,
|
||||||
IServiceFactory factory,
|
IServiceFactory factory,
|
||||||
IMediator mediator,
|
IMediator mediator,
|
||||||
IPublisher publisher,
|
IPublisher publisher,
|
||||||
@@ -9,17 +9,17 @@ public class VaultDbContext(DbContextOptions<VaultDbContext> options) :
|
|||||||
|
|
||||||
public DbSet<Document> Documents { get; set; }
|
public DbSet<Document> Documents { get; set; }
|
||||||
|
|
||||||
public DbSet<Locker> Lockers { get; set; }
|
public DbSet<Content> Items { get; set; }
|
||||||
|
|
||||||
public DbSet<Tag> Tags { get; set; }
|
public DbSet<Tag> Tags { get; set; }
|
||||||
|
|
||||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
{
|
{
|
||||||
modelBuilder.Entity<Locker>()
|
modelBuilder.Entity<Content>()
|
||||||
.HasMany(x => x.Tags)
|
.HasMany(x => x.Tags)
|
||||||
.WithOne();
|
.WithOne();
|
||||||
|
|
||||||
modelBuilder.Entity<Locker>()
|
modelBuilder.Entity<Content>()
|
||||||
.HasMany(x => x.Documents)
|
.HasMany(x => x.Documents)
|
||||||
.WithOne();
|
.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;
|
namespace Bitvault;
|
||||||
|
|
||||||
public class LockerViewModel(IServiceProvider provider,
|
public class VaultItemViewModel(IServiceProvider provider,
|
||||||
IServiceFactory factory,
|
IServiceFactory factory,
|
||||||
IMediator mediator,
|
IMediator mediator,
|
||||||
IPublisher publisher,
|
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;
|
namespace Bitvault;
|
||||||
|
|
||||||
[Notification(nameof(VaultViewModel))]
|
|
||||||
|
[Enumerate(nameof(VaultViewModel))]
|
||||||
public partial class VaultViewModel(IServiceProvider provider,
|
public partial class VaultViewModel(IServiceProvider provider,
|
||||||
IServiceFactory factory,
|
IServiceFactory factory,
|
||||||
IMediator mediator,
|
IMediator mediator,
|
||||||
@@ -11,7 +12,7 @@ public partial class VaultViewModel(IServiceProvider provider,
|
|||||||
ISubscriber subscriber,
|
ISubscriber subscriber,
|
||||||
IDisposer disposer,
|
IDisposer disposer,
|
||||||
IContentTemplate template,
|
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>>>
|
INotificationHandler<Vault<Filter<string>>>
|
||||||
{
|
{
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
@@ -31,8 +32,8 @@ public partial class VaultViewModel(IServiceProvider provider,
|
|||||||
await base.Deactivated();
|
await base.Deactivated();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override IEnumerate CreateEnumeration(object? key) =>
|
protected override IEnumerate PrepareEnumeration(object? key) =>
|
||||||
Enumerate<LockerNavigationViewModel>.With(new VaultViewModelOptions { Filter = Filter }) with { Key = key };
|
Enumerate<VaultContentNavigationViewModel>.With(new VaultViewModelOptions { Filter = Filter }) with { Key = key };
|
||||||
|
|
||||||
public async Task Handle(Vault<Filter<string>> args,
|
public async Task Handle(Vault<Filter<string>> args,
|
||||||
CancellationToken cancellationToken = default)
|
CancellationToken cancellationToken = default)
|
||||||
|
|||||||
@@ -4,18 +4,18 @@ namespace Bitvault;
|
|||||||
|
|
||||||
public class VaultViewModelHandler(IServiceFactory factory,
|
public class VaultViewModelHandler(IServiceFactory factory,
|
||||||
IPublisher publisher) :
|
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)
|
CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
if (args.Options?.Filter is "All")
|
if (args.Options?.Filter is "All")
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 100; i++)
|
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);
|
nameof(VaultViewModel), cancellationToken);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -25,9 +25,9 @@ public class VaultViewModelHandler(IServiceFactory factory,
|
|||||||
{
|
{
|
||||||
for (int i = 0; i < 10; i++)
|
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);
|
nameof(VaultViewModel), cancellationToken);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -35,11 +35,11 @@ public class VaultViewModelHandler(IServiceFactory factory,
|
|||||||
|
|
||||||
if (args.Options?.Filter is "Archive")
|
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);
|
nameof(VaultViewModel), cancellationToken);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user