Mass rename
This commit is contained in:
+3
-3
@@ -1,9 +1,9 @@
|
|||||||
<UserControl
|
<UserControl
|
||||||
x:Class="Bitvault.Avalonia.AddVaultContentActionView"
|
x:Class="Bitvault.Avalonia.AddItemActionView"
|
||||||
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:vm="using:Bitvault"
|
xmlns:vm="using:Bitvault"
|
||||||
x:DataType="vm:AddVaultContentActionViewModel">
|
x:DataType="vm:AddItemActionViewModel">
|
||||||
<Button
|
<Button
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Width="{StaticResource ButtonWidth}"
|
Width="{StaticResource ButtonWidth}"
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
ToolTip.Tip="Add item">
|
ToolTip.Tip="Add item">
|
||||||
<Interaction.Behaviors>
|
<Interaction.Behaviors>
|
||||||
<EventTriggerBehavior EventName="Click">
|
<EventTriggerBehavior EventName="Click">
|
||||||
<NavigateAction Context="{Binding Named, StringFormat='{}{0}:Content'}" Route="AddVaultContent" />
|
<NavigateAction Context="{Binding Named, StringFormat='{}{0}:Content'}" Route="AddItem" />
|
||||||
</EventTriggerBehavior>
|
</EventTriggerBehavior>
|
||||||
</Interaction.Behaviors>
|
</Interaction.Behaviors>
|
||||||
</Button>
|
</Button>
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
using Avalonia.Controls;
|
||||||
|
|
||||||
|
namespace Bitvault.Avalonia;
|
||||||
|
|
||||||
|
public partial class AddItemActionView : UserControl
|
||||||
|
{
|
||||||
|
public AddItemActionView() => InitializeComponent();
|
||||||
|
}
|
||||||
+2
-2
@@ -1,9 +1,9 @@
|
|||||||
<UserControl
|
<UserControl
|
||||||
x:Class="Bitvault.Avalonia.AddVaultContentCommandHeaderView"
|
x:Class="Bitvault.Avalonia.AddItemCommandHeaderView"
|
||||||
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:vm="using:Bitvault"
|
xmlns:vm="using:Bitvault"
|
||||||
x:DataType="vm:AddVaultContentCommandHeaderViewModel">
|
x:DataType="vm:AddItemCommandHeaderViewModel">
|
||||||
<UserControl.Resources>
|
<UserControl.Resources>
|
||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
<x:Double x:Key="ButtonWidth">40</x:Double>
|
<x:Double x:Key="ButtonWidth">40</x:Double>
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
using Avalonia.Controls;
|
||||||
|
|
||||||
|
namespace Bitvault.Avalonia;
|
||||||
|
|
||||||
|
public partial class AddItemCommandHeaderView : UserControl
|
||||||
|
{
|
||||||
|
public AddItemCommandHeaderView() => InitializeComponent();
|
||||||
|
}
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
<UserControl
|
<UserControl
|
||||||
x:Class="Bitvault.Avalonia.AddVaultContentView"
|
x:Class="Bitvault.Avalonia.AddItemView"
|
||||||
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:vm="using:Bitvault"
|
xmlns:vm="using:Bitvault"
|
||||||
x:DataType="vm:AddVaultContentViewModel">
|
x:DataType="vm:AddItemViewModel">
|
||||||
<Interaction.Behaviors>
|
<Interaction.Behaviors>
|
||||||
<EventTriggerBehavior EventName="Loaded">
|
<EventTriggerBehavior EventName="Loaded">
|
||||||
<NavigateAction Context="{Binding Named, StringFormat='{}{0}:ContentHeader'}" Route="AddVaultContentCommandHeader" />
|
<NavigateAction Context="{Binding Named, StringFormat='{}{0}:ContentHeader'}" Route="AddVaultContentCommandHeader" />
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
using Avalonia.Controls;
|
||||||
|
|
||||||
|
namespace Bitvault.Avalonia;
|
||||||
|
|
||||||
|
public partial class AddItemView : UserControl
|
||||||
|
{
|
||||||
|
public AddItemView() => InitializeComponent();
|
||||||
|
}
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
using Avalonia.Controls;
|
|
||||||
|
|
||||||
namespace Bitvault.Avalonia;
|
|
||||||
|
|
||||||
public partial class AddVaultContentActionView : UserControl
|
|
||||||
{
|
|
||||||
public AddVaultContentActionView() => InitializeComponent();
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
using Avalonia.Controls;
|
|
||||||
|
|
||||||
namespace Bitvault.Avalonia;
|
|
||||||
|
|
||||||
public partial class AddVaultContentCommandHeaderView : UserControl
|
|
||||||
{
|
|
||||||
public AddVaultContentCommandHeaderView() => InitializeComponent();
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
using Avalonia.Controls;
|
|
||||||
|
|
||||||
namespace Bitvault.Avalonia;
|
|
||||||
|
|
||||||
public partial class AddVaultContentView : UserControl
|
|
||||||
{
|
|
||||||
public AddVaultContentView() => InitializeComponent();
|
|
||||||
}
|
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
<ComparisonCondition LeftOperand="{Binding Activated}" RightOperand="False" />
|
<ComparisonCondition LeftOperand="{Binding Activated}" RightOperand="False" />
|
||||||
</ConditionalExpression>
|
</ConditionalExpression>
|
||||||
</ConditionAction.Condition>
|
</ConditionAction.Condition>
|
||||||
<NavigateAction Context="Main" Route="Vault">
|
<NavigateAction Context="Main" Route="Container">
|
||||||
<NavigateAction.ParameterBindings>
|
<NavigateAction.ParameterBindings>
|
||||||
<ParameterBinding Key="Filter" Value="{Binding Filter}" />
|
<ParameterBinding Key="Filter" Value="{Binding Filter}" />
|
||||||
</NavigateAction.ParameterBindings>
|
</NavigateAction.ParameterBindings>
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public partial class App : Application
|
|||||||
public override async void OnFrameworkInitializationCompleted()
|
public override async void OnFrameworkInitializationCompleted()
|
||||||
{
|
{
|
||||||
IHost? host = DefaultHostBuilder.Create()
|
IHost? host = DefaultHostBuilder.Create()
|
||||||
.AddConfiguration<VaultConfiguration>(args => args.Name = "Personal",
|
.AddConfiguration<ContainerConfiguration>(args => args.Name = "Personal",
|
||||||
"Vault:*")
|
"Vault:*")
|
||||||
.ConfigureServices((context, services) =>
|
.ConfigureServices((context, services) =>
|
||||||
{
|
{
|
||||||
@@ -35,7 +35,7 @@ public partial class App : Application
|
|||||||
services.AddTemplate<MainWindowViewModel, MainWindow>("MainWindow");
|
services.AddTemplate<MainWindowViewModel, MainWindow>("MainWindow");
|
||||||
}
|
}
|
||||||
|
|
||||||
services.AddTransient<IVaultComponent> (provider => Component.Create<VaultComponent>(provider, args =>
|
services.AddTransient<IContainerComponent> (provider => Component.Create<ContainerComponent>(provider, args =>
|
||||||
{
|
{
|
||||||
args.AddServices(services =>
|
args.AddServices(services =>
|
||||||
{
|
{
|
||||||
@@ -46,55 +46,55 @@ public partial class App : Application
|
|||||||
services.AddTransient<IPasswordHasher, PasswordHasher>();
|
services.AddTransient<IPasswordHasher, PasswordHasher>();
|
||||||
services.AddTransient<IKeyDeriver, KeyDeriver>();
|
services.AddTransient<IKeyDeriver, KeyDeriver>();
|
||||||
|
|
||||||
services.AddTransient<IVaultKeyFactory, VaultKeyFactory>();
|
services.AddTransient<ISecurityKeyFactory, SecurityKeyFactory>();
|
||||||
services.AddTransient<IVaultStorage, VaultStorage>();
|
services.AddTransient<IContainer, ContainerFactory>();
|
||||||
services.TryAddSingleton<IContainer<VaultKey>, Container<VaultKey>>();
|
services.TryAddSingleton<IContainer<SecurityKey>, Container<SecurityKey>>();
|
||||||
services.TryAddSingleton<IContainer<VaultStorageConnection>, Container<VaultStorageConnection>>();
|
services.TryAddSingleton<IContainer<ContaienrConnection>, Container<ContaienrConnection>>();
|
||||||
|
|
||||||
services.AddDbContextFactory<VaultDbContext>((provider, args) =>
|
services.AddDbContextFactory<VaultDbContext>((provider, args) =>
|
||||||
{
|
{
|
||||||
if (provider.GetRequiredService<IContainer<VaultStorageConnection>>()
|
if (provider.GetRequiredService<IContainer<ContaienrConnection>>()
|
||||||
is IContainer<VaultStorageConnection> connection)
|
is IContainer<ContaienrConnection> connection)
|
||||||
{
|
{
|
||||||
args.UseSqlite($"{connection.Value}");
|
args.UseSqlite($"{connection.Value}");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
services.AddHandler<OpenVaultHandler>();
|
services.AddHandler<OpenContainerHandler>();
|
||||||
|
|
||||||
services.AddTemplate<VaultNavigationViewModel, VaultNavigationView>();
|
services.AddTemplate<ContainerNavigationViewModel, ContainerNavigationView>();
|
||||||
services.AddTemplate<AllNavigationViewModel, AllNavigationView>();
|
services.AddTemplate<AllNavigationViewModel, AllNavigationView>();
|
||||||
services.AddTemplate<StarredNavigationViewModel, StarredNavigationView>();
|
services.AddTemplate<StarredNavigationViewModel, StarredNavigationView>();
|
||||||
services.AddTemplate<CategoriesNavigationViewModel, CategoriesNavigationView>();
|
services.AddTemplate<CategoriesNavigationViewModel, CategoriesNavigationView>();
|
||||||
services.AddTemplate<ArchiveNavigationViewModel, ArchiveNavigationView>();
|
services.AddTemplate<ArchiveNavigationViewModel, ArchiveNavigationView>();
|
||||||
|
|
||||||
services.AddTemplate<OpenVaultViewModel, OpenView>("OpenVault");
|
services.AddTemplate<OpenContainerViewModel, OpenView>("OpenContainer");
|
||||||
|
|
||||||
services.AddTemplate<VaultViewModel, VaultView>("Vault");
|
services.AddTemplate<ContainerViewModel, ContainerView>("Container");
|
||||||
services.AddHandler<VaultViewModelHandler>();
|
services.AddHandler<ContainerViewModelHandler>();
|
||||||
|
|
||||||
services.AddTemplate<VaultSearchHeaderViewModel, VaultSearchHeaderView>("VaultSearchHeader");
|
services.AddTemplate<SearchHeaderViewModel, SearchHeaderView>("SearchHeader");
|
||||||
services.AddTemplate<VaultHeaderViewModel, VaultHeaderView>("VaultHeader");
|
services.AddTemplate<ContainerHeaderViewModel, ContainerHeaderView>("ContainerHeader");
|
||||||
services.AddTemplate<AddVaultContentActionViewModel, AddVaultContentActionView>();
|
services.AddTemplate<AddItemActionViewModel, AddItemActionView>();
|
||||||
|
|
||||||
services.AddTemplate<VaultContentNavigationViewModel, VaultContentNavigationView>();
|
services.AddTemplate<ItemNavigationViewModel, ItemNavigationView>();
|
||||||
services.AddTemplate<VaultContentViewModel, VaultContentView>("VaultContent");
|
services.AddTemplate<ItemViewModel, ItemView>("AddItem");
|
||||||
|
|
||||||
services.AddTemplate<AddVaultContentViewModel, AddVaultContentView>("AddVaultContent");
|
services.AddTemplate<AddItemViewModel, AddItemView>("AddAddItem");
|
||||||
services.AddTemplate<AddVaultContentCommandHeaderViewModel, AddVaultContentCommandHeaderView>("AddVaultContentCommandHeader");
|
services.AddTemplate<AddItemCommandHeaderViewModel, AddItemCommandHeaderView>("AddVaultContentCommandHeader");
|
||||||
|
|
||||||
services.AddTemplate<ConfirmVaultContentActionViewModel, ConfirmVaultContentActionView>();
|
services.AddTemplate<ConfirmItemActionViewModel, ConfirmVaultContentActionView>();
|
||||||
services.AddTemplate<DismissVaultContentActionViewModel, DismissVaultContentActionView>();
|
services.AddTemplate<DismissItemActionViewModel, DismissItemActionView>();
|
||||||
|
|
||||||
services.AddTemplate<VaultContentHeaderViewModel, VaultContentHeaderView>();
|
services.AddTemplate<ItemHeaderViewModel, ItemHeaderView>();
|
||||||
});
|
});
|
||||||
})!);
|
})!);
|
||||||
|
|
||||||
services.AddTransient<IVaultComponentFactory, VaultComponentFactory>();
|
services.AddTransient<IContainerComponentFactory, ContainerComponentFactory>();
|
||||||
services.AddHandler<CreateVaultHandler>();
|
services.AddHandler<CreateContainerHandler>();
|
||||||
|
|
||||||
services.AddSingleton<IVaultHostCollection, VaultHostCollection>();
|
services.AddSingleton<IContainerHostCollection, ContainerHostCollection>();
|
||||||
services.AddInitializer<VaultCollectionInitializer>();
|
services.AddInitializer<ContainerCollectionInitializer>();
|
||||||
|
|
||||||
services.AddTemplate<MainViewModel, MainView>("Main");
|
services.AddTemplate<MainViewModel, MainView>("Main");
|
||||||
services.AddHandler<MainViewModelHandler>();
|
services.AddHandler<MainViewModelHandler>();
|
||||||
@@ -104,8 +104,8 @@ public partial class App : Application
|
|||||||
services.AddTemplate<ManageNavigationViewModel, ManageNavigationView>();
|
services.AddTemplate<ManageNavigationViewModel, ManageNavigationView>();
|
||||||
services.AddTemplate<ManageViewModel, ManageView>("Manage");
|
services.AddTemplate<ManageViewModel, ManageView>("Manage");
|
||||||
|
|
||||||
services.AddTemplate<CreateVaultNavigationViewModel, CreateVaultNavigationView>();
|
services.AddTemplate<CreateContainerNavigationViewModel, CreateContainerNavigationView>();
|
||||||
services.AddTemplate<CreateVaultViewModel, CreateVaultView>("CreateVault");
|
services.AddTemplate<CreateContainerViewModel, CreateContainerView>("CreateContainer");
|
||||||
})
|
})
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
|
|||||||
@@ -40,14 +40,26 @@
|
|||||||
<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">
|
<Compile Update="AddItemActionView.axaml.cs">
|
||||||
<DependentUpon>AddVaultContentActionView.axaml</DependentUpon>
|
<DependentUpon>AddItemActionView.axaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Update="AddVaultContentCommandHeaderView.axaml.cs">
|
<Compile Update="AddItemCommandHeaderView.axaml.cs">
|
||||||
<DependentUpon>AddVaultContentCommandHeaderView.axaml</DependentUpon>
|
<DependentUpon>AddItemCommandHeaderView.axaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Update="VaultContentHeaderView.axaml.cs">
|
<Compile Update="AddItemView.axaml.cs">
|
||||||
<DependentUpon>VaultContentHeaderView.axaml</DependentUpon>
|
<DependentUpon>AddItemView.axaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Update="CreateContainerNavigationView.axaml.cs">
|
||||||
|
<DependentUpon>CreateContainerNavigationView.axaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Update="CreateContainerView.axaml.cs">
|
||||||
|
<DependentUpon>CreateContainerView.axaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Update="DismissItemActionView.axaml.cs">
|
||||||
|
<DependentUpon>DismissItemActionView.axaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Update="ItemHeaderView.axaml.cs">
|
||||||
|
<DependentUpon>ItemHeaderView.axaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Update="OpenView.axaml.cs">
|
<Compile Update="OpenView.axaml.cs">
|
||||||
<DependentUpon>OpenView.axaml</DependentUpon>
|
<DependentUpon>OpenView.axaml</DependentUpon>
|
||||||
@@ -55,11 +67,23 @@
|
|||||||
<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">
|
<Compile Update="ContainerHeaderView.axaml.cs">
|
||||||
<DependentUpon>VaultHeaderView.axaml</DependentUpon>
|
<DependentUpon>ContainerHeaderView.axaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Update="VaultNavigationView.axaml.cs">
|
<Compile Update="ItemNavigationView.axaml.cs">
|
||||||
<DependentUpon>VaultNavigationView.axaml</DependentUpon>
|
<DependentUpon>ItemNavigationView.axaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Update="ItemView.axaml.cs">
|
||||||
|
<DependentUpon>ItemView.axaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Update="ContainerNavigationView.axaml.cs">
|
||||||
|
<DependentUpon>ContainerNavigationView.axaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Update="SearchHeaderView.axaml.cs">
|
||||||
|
<DependentUpon>SearchHeaderView.axaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Update="ContainerView.axaml.cs">
|
||||||
|
<DependentUpon>ContainerView.axaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
+2
-2
@@ -1,9 +1,9 @@
|
|||||||
<UserControl
|
<UserControl
|
||||||
x:Class="Bitvault.Avalonia.VaultHeaderView"
|
x:Class="Bitvault.Avalonia.ContainerHeaderView"
|
||||||
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:vm="using:Bitvault"
|
xmlns:vm="using:Bitvault"
|
||||||
x:DataType="vm:VaultHeaderViewModel">
|
x:DataType="vm:ContainerHeaderViewModel">
|
||||||
<UserControl.Resources>
|
<UserControl.Resources>
|
||||||
<x:Double x:Key="ButtonWidth">40</x:Double>
|
<x:Double x:Key="ButtonWidth">40</x:Double>
|
||||||
<x:Double x:Key="ButtonHeight">36</x:Double>
|
<x:Double x:Key="ButtonHeight">36</x:Double>
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
using Avalonia.Controls;
|
||||||
|
|
||||||
|
namespace Bitvault.Avalonia;
|
||||||
|
|
||||||
|
public partial class ContainerHeaderView : UserControl
|
||||||
|
{
|
||||||
|
public ContainerHeaderView() => InitializeComponent();
|
||||||
|
}
|
||||||
+6
-6
@@ -1,10 +1,10 @@
|
|||||||
<NavigationViewItem
|
<NavigationViewItem
|
||||||
x:Class="Bitvault.Avalonia.VaultNavigationView"
|
x:Class="Bitvault.Avalonia.ContainerNavigationView"
|
||||||
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:vm="using:Bitvault"
|
xmlns:vm="using:Bitvault"
|
||||||
x:Name="NavigationViewItem"
|
x:Name="NavigationViewItem"
|
||||||
x:DataType="vm:VaultNavigationViewModel"
|
x:DataType="vm:ContainerNavigationViewModel"
|
||||||
Content="{Binding Name}"
|
Content="{Binding Name}"
|
||||||
IsExpanded="{Binding Expanded}"
|
IsExpanded="{Binding Expanded}"
|
||||||
IsSelected="{Binding Selected}"
|
IsSelected="{Binding Selected}"
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
<ComparisonCondition LeftOperand="{Binding Selected}" RightOperand="True" />
|
<ComparisonCondition LeftOperand="{Binding Selected}" RightOperand="True" />
|
||||||
</ConditionalExpression>
|
</ConditionalExpression>
|
||||||
</ConditionAction.Condition>
|
</ConditionAction.Condition>
|
||||||
<NavigateAction Context="Main" Route="OpenVault" />
|
<NavigateAction Context="Main" Route="OpenContainer" />
|
||||||
<ChangePropertyAction
|
<ChangePropertyAction
|
||||||
PropertyName="SelectsOnInvoked"
|
PropertyName="SelectsOnInvoked"
|
||||||
TargetObject="{Binding #NavigationViewItem}"
|
TargetObject="{Binding #NavigationViewItem}"
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
<ComparisonCondition LeftOperand="{Binding Selected}" RightOperand="True" />
|
<ComparisonCondition LeftOperand="{Binding Selected}" RightOperand="True" />
|
||||||
</ConditionalExpression>
|
</ConditionalExpression>
|
||||||
</ConditionAction.Condition>
|
</ConditionAction.Condition>
|
||||||
<NavigateAction Context="Main" Route="Vault" />
|
<NavigateAction Context="Main" Route="Container" />
|
||||||
<ChangePropertyAction
|
<ChangePropertyAction
|
||||||
PropertyName="SelectsOnInvoked"
|
PropertyName="SelectsOnInvoked"
|
||||||
TargetObject="{Binding #NavigationViewItem}"
|
TargetObject="{Binding #NavigationViewItem}"
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
<ComparisonCondition LeftOperand="{Binding Opened}" RightOperand="False" />
|
<ComparisonCondition LeftOperand="{Binding Opened}" RightOperand="False" />
|
||||||
</ConditionalExpression>
|
</ConditionalExpression>
|
||||||
</ConditionAction.Condition>
|
</ConditionAction.Condition>
|
||||||
<NavigateAction Context="Main" Route="OpenVault" />
|
<NavigateAction Context="Main" Route="OpenContainer" />
|
||||||
</ConditionAction>
|
</ConditionAction>
|
||||||
<ConditionAction>
|
<ConditionAction>
|
||||||
<ConditionAction.Condition>
|
<ConditionAction.Condition>
|
||||||
@@ -57,7 +57,7 @@
|
|||||||
<ComparisonCondition LeftOperand="{Binding Activated}" RightOperand="False" />
|
<ComparisonCondition LeftOperand="{Binding Activated}" RightOperand="False" />
|
||||||
</ConditionalExpression>
|
</ConditionalExpression>
|
||||||
</ConditionAction.Condition>
|
</ConditionAction.Condition>
|
||||||
<NavigateAction Context="Main" Route="Vault" />
|
<NavigateAction Context="Main" Route="Container" />
|
||||||
<InvokeNavigationViewItemAction />
|
<InvokeNavigationViewItemAction />
|
||||||
</ConditionAction>
|
</ConditionAction>
|
||||||
</AttachedEventTriggerBehaviour>
|
</AttachedEventTriggerBehaviour>
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
using Toolkit.UI.Controls.Avalonia;
|
||||||
|
|
||||||
|
namespace Bitvault.Avalonia;
|
||||||
|
|
||||||
|
public partial class ContainerNavigationView : NavigationViewItem
|
||||||
|
{
|
||||||
|
public ContainerNavigationView() => InitializeComponent();
|
||||||
|
}
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
<UserControl
|
<UserControl
|
||||||
x:Class="Bitvault.Avalonia.VaultView"
|
x:Class="Bitvault.Avalonia.ContainerView"
|
||||||
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:vm="using:Bitvault"
|
xmlns:vm="using:Bitvault"
|
||||||
x:DataType="vm:VaultViewModel">
|
x:DataType="vm:ContainerViewModel">
|
||||||
<Grid ColumnDefinitions="320,Auto,*" RowDefinitions="Auto,*">
|
<Grid ColumnDefinitions="320,Auto,*" RowDefinitions="Auto,*">
|
||||||
<ContentControl
|
<ContentControl
|
||||||
Grid.Row="0"
|
Grid.Row="0"
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
Margin="4,4,0,0">
|
Margin="4,4,0,0">
|
||||||
<Interaction.Behaviors>
|
<Interaction.Behaviors>
|
||||||
<EventTriggerBehavior EventName="Loaded">
|
<EventTriggerBehavior EventName="Loaded">
|
||||||
<NavigateAction Context="{Binding $self}" Route="VaultHeader" />
|
<NavigateAction Context="{Binding $self}" Route="ContainerHeader" />
|
||||||
</EventTriggerBehavior>
|
</EventTriggerBehavior>
|
||||||
</Interaction.Behaviors>
|
</Interaction.Behaviors>
|
||||||
</ContentControl>
|
</ContentControl>
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
using Avalonia.Controls;
|
||||||
|
|
||||||
|
namespace Bitvault.Avalonia;
|
||||||
|
|
||||||
|
public partial class ContainerView : UserControl
|
||||||
|
{
|
||||||
|
public ContainerView() => InitializeComponent();
|
||||||
|
}
|
||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
<SettingsExpander
|
<SettingsExpander
|
||||||
x:Class="Bitvault.Avalonia.CreateVaultNavigationView"
|
x:Class="Bitvault.Avalonia.CreateContainerNavigationView"
|
||||||
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"
|
||||||
Description="Keep organized by separating your things into vaults."
|
Description="Keep organized by separating your things into vaults."
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
<Button MinWidth="132" Content="Create vault">
|
<Button MinWidth="132" Content="Create vault">
|
||||||
<Interaction.Behaviors>
|
<Interaction.Behaviors>
|
||||||
<EventTriggerBehavior EventName="Click">
|
<EventTriggerBehavior EventName="Click">
|
||||||
<NavigateAction Route="CreateVault" />
|
<NavigateAction Route="CreateContainer" />
|
||||||
</EventTriggerBehavior>
|
</EventTriggerBehavior>
|
||||||
</Interaction.Behaviors>
|
</Interaction.Behaviors>
|
||||||
</Button>
|
</Button>
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
using Toolkit.UI.Controls.Avalonia;
|
||||||
|
|
||||||
|
namespace Bitvault.Avalonia;
|
||||||
|
|
||||||
|
public partial class CreateContainerNavigationView : SettingsExpander
|
||||||
|
{
|
||||||
|
public CreateContainerNavigationView() => InitializeComponent();
|
||||||
|
}
|
||||||
+2
-2
@@ -1,10 +1,10 @@
|
|||||||
<ContentDialog
|
<ContentDialog
|
||||||
x:Class="Bitvault.Avalonia.CreateVaultView"
|
x:Class="Bitvault.Avalonia.CreateContainerView"
|
||||||
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:vm="using:Bitvault"
|
xmlns:vm="using:Bitvault"
|
||||||
Title="Create vault"
|
Title="Create vault"
|
||||||
x:DataType="vm:CreateVaultViewModel"
|
x:DataType="vm:CreateContainerViewModel"
|
||||||
CloseButtonText="Cancel"
|
CloseButtonText="Cancel"
|
||||||
PrimaryButtonText="Create">
|
PrimaryButtonText="Create">
|
||||||
<StackPanel Width="400">
|
<StackPanel Width="400">
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
using Toolkit.UI.Controls.Avalonia;
|
||||||
|
|
||||||
|
namespace Bitvault.Avalonia;
|
||||||
|
|
||||||
|
public partial class CreateContainerView : ContentDialog
|
||||||
|
{
|
||||||
|
public CreateContainerView() => InitializeComponent();
|
||||||
|
}
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
using Toolkit.UI.Controls.Avalonia;
|
|
||||||
|
|
||||||
namespace Bitvault.Avalonia;
|
|
||||||
|
|
||||||
public partial class CreateVaultNavigationView : SettingsExpander
|
|
||||||
{
|
|
||||||
public CreateVaultNavigationView() => InitializeComponent();
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
using Toolkit.UI.Controls.Avalonia;
|
|
||||||
|
|
||||||
namespace Bitvault.Avalonia;
|
|
||||||
|
|
||||||
public partial class CreateVaultView : ContentDialog
|
|
||||||
{
|
|
||||||
public CreateVaultView() => InitializeComponent();
|
|
||||||
}
|
|
||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
<UserControl
|
<UserControl
|
||||||
x:Class="Bitvault.Avalonia.DismissVaultContentActionView"
|
x:Class="Bitvault.Avalonia.DismissItemActionView"
|
||||||
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">
|
||||||
<Button
|
<Button
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
using Avalonia.Controls;
|
||||||
|
|
||||||
|
namespace Bitvault.Avalonia;
|
||||||
|
|
||||||
|
public partial class DismissItemActionView : UserControl
|
||||||
|
{
|
||||||
|
public DismissItemActionView() => InitializeComponent();
|
||||||
|
}
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
using Avalonia.Controls;
|
|
||||||
|
|
||||||
namespace Bitvault.Avalonia;
|
|
||||||
|
|
||||||
public partial class DismissVaultContentActionView : UserControl
|
|
||||||
{
|
|
||||||
public DismissVaultContentActionView() => InitializeComponent();
|
|
||||||
}
|
|
||||||
+2
-2
@@ -1,9 +1,9 @@
|
|||||||
<UserControl
|
<UserControl
|
||||||
x:Class="Bitvault.Avalonia.VaultContentHeaderView"
|
x:Class="Bitvault.Avalonia.ItemHeaderView"
|
||||||
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:vm="using:Bitvault"
|
xmlns:vm="using:Bitvault"
|
||||||
x:DataType="vm:VaultContentHeaderViewModel">
|
x:DataType="vm:ItemHeaderViewModel">
|
||||||
<StackPanel Grid.Column="1" Spacing="18">
|
<StackPanel Grid.Column="1" Spacing="18">
|
||||||
<PersonPicture
|
<PersonPicture
|
||||||
Width="96"
|
Width="96"
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
using Avalonia.Controls;
|
||||||
|
|
||||||
|
namespace Bitvault.Avalonia;
|
||||||
|
|
||||||
|
public partial class ItemHeaderView : UserControl
|
||||||
|
{
|
||||||
|
public ItemHeaderView() => InitializeComponent();
|
||||||
|
}
|
||||||
+3
-3
@@ -1,14 +1,14 @@
|
|||||||
<ListBoxItem
|
<ListBoxItem
|
||||||
x:Class="Bitvault.Avalonia.VaultContentNavigationView"
|
x:Class="Bitvault.Avalonia.ItemNavigationView"
|
||||||
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:vm="using:Bitvault"
|
xmlns:vm="using:Bitvault"
|
||||||
x:Name="Name"
|
x:Name="Name"
|
||||||
x:CompileBindings="False"
|
x:CompileBindings="False"
|
||||||
x:DataType="vm:VaultContentNavigationViewModel">
|
x:DataType="vm:ItemNavigationViewModel">
|
||||||
<Interaction.Behaviors>
|
<Interaction.Behaviors>
|
||||||
<DataTriggerBehavior Binding="{Binding Selected}" Value="True">
|
<DataTriggerBehavior Binding="{Binding Selected}" Value="True">
|
||||||
<NavigateAction Context="{Binding Named, StringFormat='{}{0}:Content'}" Route="VaultContent" />
|
<NavigateAction Context="{Binding Named, StringFormat='{}{0}:Content'}" Route="AddItem" />
|
||||||
</DataTriggerBehavior>
|
</DataTriggerBehavior>
|
||||||
</Interaction.Behaviors>
|
</Interaction.Behaviors>
|
||||||
<Grid ColumnDefinitions="Auto,*">
|
<Grid ColumnDefinitions="Auto,*">
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
using Avalonia.Controls;
|
||||||
|
|
||||||
|
namespace Bitvault.Avalonia;
|
||||||
|
|
||||||
|
public partial class ItemNavigationView : ListBoxItem
|
||||||
|
{
|
||||||
|
public ItemNavigationView() => InitializeComponent();
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<UserControl
|
<UserControl
|
||||||
x:Class="Bitvault.Avalonia.VaultContentView"
|
x:Class="Bitvault.Avalonia.ItemView"
|
||||||
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">
|
||||||
Vault content placeholder
|
Vault content placeholder
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
using Avalonia.Controls;
|
||||||
|
|
||||||
|
namespace Bitvault.Avalonia;
|
||||||
|
|
||||||
|
public partial class ItemView : UserControl
|
||||||
|
{
|
||||||
|
public ItemView() => InitializeComponent();
|
||||||
|
}
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
<Interaction.Behaviors>
|
<Interaction.Behaviors>
|
||||||
<EventTriggerBehavior EventName="Loaded">
|
<EventTriggerBehavior EventName="Loaded">
|
||||||
<NavigateRegionAction Name="Main">
|
<NavigateRegionAction Name="Main">
|
||||||
<NavigateAction Context="Main" Route="Vault" />
|
<NavigateAction Context="Main" Route="Container" />
|
||||||
</NavigateRegionAction>
|
</NavigateRegionAction>
|
||||||
</EventTriggerBehavior>
|
</EventTriggerBehavior>
|
||||||
</Interaction.Behaviors>
|
</Interaction.Behaviors>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
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:vm="using:Bitvault"
|
xmlns:vm="using:Bitvault"
|
||||||
x:DataType="vm:OpenVaultViewModel">
|
x:DataType="vm:OpenContainerViewModel">
|
||||||
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
|
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||||
<TextBox
|
<TextBox
|
||||||
Width="300"
|
Width="300"
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
<UserControl
|
<UserControl
|
||||||
x:Class="Bitvault.Avalonia.VaultSearchHeaderView"
|
x:Class="Bitvault.Avalonia.SearchHeaderView"
|
||||||
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">
|
||||||
<AutoCompleteBox VerticalAlignment="Center" />
|
<AutoCompleteBox VerticalAlignment="Center" />
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
using Avalonia.Controls;
|
||||||
|
|
||||||
|
namespace Bitvault.Avalonia;
|
||||||
|
|
||||||
|
public partial class SearchHeaderView : UserControl
|
||||||
|
{
|
||||||
|
public SearchHeaderView() => InitializeComponent();
|
||||||
|
}
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
<UserControl
|
|
||||||
x:Class="Bitvault.Avalonia.VaultCommandView"
|
|
||||||
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!
|
|
||||||
</UserControl>
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
using Avalonia.Controls;
|
|
||||||
|
|
||||||
namespace Bitvault.Avalonia;
|
|
||||||
|
|
||||||
public partial class VaultCommandView : UserControl
|
|
||||||
{
|
|
||||||
public VaultCommandView() => InitializeComponent();
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
using Avalonia.Controls;
|
|
||||||
|
|
||||||
namespace Bitvault.Avalonia;
|
|
||||||
|
|
||||||
public partial class VaultContentHeaderView : UserControl
|
|
||||||
{
|
|
||||||
public VaultContentHeaderView() => InitializeComponent();
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
using Avalonia.Controls;
|
|
||||||
|
|
||||||
namespace Bitvault.Avalonia
|
|
||||||
{
|
|
||||||
public partial class VaultContentNavigationView : ListBoxItem
|
|
||||||
{
|
|
||||||
public VaultContentNavigationView()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
Tapped += VaultContentNavigationView_Tapped;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void VaultContentNavigationView_Tapped(object? sender, global::Avalonia.Input.TappedEventArgs e)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
using Avalonia.Controls;
|
|
||||||
|
|
||||||
namespace Bitvault.Avalonia;
|
|
||||||
|
|
||||||
public partial class VaultContentView : UserControl
|
|
||||||
{
|
|
||||||
public VaultContentView() => InitializeComponent();
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
using Avalonia.Controls;
|
|
||||||
|
|
||||||
namespace Bitvault.Avalonia;
|
|
||||||
|
|
||||||
public partial class VaultHeaderView : UserControl
|
|
||||||
{
|
|
||||||
public VaultHeaderView() => InitializeComponent();
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
using Toolkit.UI.Avalonia;
|
|
||||||
using Toolkit.UI.Controls.Avalonia;
|
|
||||||
|
|
||||||
namespace Bitvault.Avalonia
|
|
||||||
{
|
|
||||||
public partial class VaultNavigationView : NavigationViewItem
|
|
||||||
{
|
|
||||||
public VaultNavigationView()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Test(object? sender, ItemInvokedEventArgs args)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
using Avalonia.Controls;
|
|
||||||
|
|
||||||
namespace Bitvault.Avalonia
|
|
||||||
{
|
|
||||||
public partial class VaultSearchHeaderView : UserControl
|
|
||||||
{
|
|
||||||
public VaultSearchHeaderView()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
using Avalonia.Controls;
|
|
||||||
|
|
||||||
namespace Bitvault.Avalonia;
|
|
||||||
|
|
||||||
public partial class VaultView : UserControl
|
|
||||||
{
|
|
||||||
public VaultView() => InitializeComponent();
|
|
||||||
}
|
|
||||||
@@ -3,7 +3,7 @@ using Toolkit.Foundation;
|
|||||||
|
|
||||||
namespace Bitvault;
|
namespace Bitvault;
|
||||||
|
|
||||||
public partial class AddVaultContentActionViewModel(IServiceProvider provider,
|
public partial class AddItemActionViewModel(IServiceProvider provider,
|
||||||
IServiceFactory factory,
|
IServiceFactory factory,
|
||||||
IMediator mediator,
|
IMediator mediator,
|
||||||
IPublisher publisher,
|
IPublisher publisher,
|
||||||
+4
-4
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
namespace Bitvault;
|
namespace Bitvault;
|
||||||
|
|
||||||
public partial class AddVaultContentCommandHeaderViewModel : ObservableCollectionViewModel
|
public partial class AddItemCommandHeaderViewModel : ObservableCollectionViewModel
|
||||||
{
|
{
|
||||||
public AddVaultContentCommandHeaderViewModel(IServiceProvider provider,
|
public AddItemCommandHeaderViewModel(IServiceProvider provider,
|
||||||
IServiceFactory factory,
|
IServiceFactory factory,
|
||||||
IMediator mediator,
|
IMediator mediator,
|
||||||
IPublisher publisher,
|
IPublisher publisher,
|
||||||
@@ -12,8 +12,8 @@ public partial class AddVaultContentCommandHeaderViewModel : ObservableCollectio
|
|||||||
IDisposer disposer,
|
IDisposer disposer,
|
||||||
IContentTemplate template) : base(provider, factory, mediator, publisher, subscriber, disposer)
|
IContentTemplate template) : base(provider, factory, mediator, publisher, subscriber, disposer)
|
||||||
{
|
{
|
||||||
Add<ConfirmVaultContentActionViewModel>();
|
Add<ConfirmItemActionViewModel>();
|
||||||
Add<DismissVaultContentActionViewModel>();
|
Add<DismissItemActionViewModel>();
|
||||||
|
|
||||||
Template = template;
|
Template = template;
|
||||||
}
|
}
|
||||||
@@ -3,13 +3,13 @@ using Toolkit.Foundation;
|
|||||||
|
|
||||||
namespace Bitvault;
|
namespace Bitvault;
|
||||||
|
|
||||||
public partial class AddVaultContentViewModel :
|
public partial class AddItemViewModel :
|
||||||
ObservableCollectionViewModel<IVaultContentEntryViewModel>
|
ObservableCollectionViewModel<IItemViewModel>
|
||||||
{
|
{
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
private string named;
|
private string named;
|
||||||
|
|
||||||
public AddVaultContentViewModel(IServiceProvider provider,
|
public AddItemViewModel(IServiceProvider provider,
|
||||||
IServiceFactory factory,
|
IServiceFactory factory,
|
||||||
IMediator mediator,
|
IMediator mediator,
|
||||||
IPublisher publisher,
|
IPublisher publisher,
|
||||||
@@ -21,15 +21,15 @@ public partial class AddVaultContentViewModel :
|
|||||||
Template = template;
|
Template = template;
|
||||||
Named = $"{named}";
|
Named = $"{named}";
|
||||||
|
|
||||||
Add<VaultContentHeaderViewModel>();
|
Add<ItemHeaderViewModel>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IContentTemplate Template { get; set; }
|
public IContentTemplate Template { get; set; }
|
||||||
|
|
||||||
public Task<bool> Confirm()
|
public Task<bool> Confirm()
|
||||||
{
|
{
|
||||||
VaultContentConfiguration configuration = new();
|
ItemConfiguration configuration = new();
|
||||||
foreach (IVaultContentEntryViewModel item in this)
|
foreach (IItemViewModel item in this)
|
||||||
{
|
{
|
||||||
item.Invoke(configuration);
|
item.Invoke(configuration);
|
||||||
}
|
}
|
||||||
@@ -8,4 +8,4 @@ public partial class AllNavigationViewModel(IServiceProvider provider,
|
|||||||
IPublisher publisher,
|
IPublisher publisher,
|
||||||
ISubscriber subscriber,
|
ISubscriber subscriber,
|
||||||
IDisposer disposer,
|
IDisposer disposer,
|
||||||
string filter) : FilterVaultNavigationViewModel(provider, factory, mediator, publisher, subscriber, disposer, filter);
|
string filter) : FilterContainerNavigationViewModel(provider, factory, mediator, publisher, subscriber, disposer, filter);
|
||||||
|
|||||||
@@ -8,4 +8,4 @@ public partial class ArchiveNavigationViewModel(IServiceProvider provider,
|
|||||||
IPublisher publisher,
|
IPublisher publisher,
|
||||||
ISubscriber subscriber,
|
ISubscriber subscriber,
|
||||||
IDisposer disposer,
|
IDisposer disposer,
|
||||||
string name) : FilterVaultNavigationViewModel(provider, factory, mediator, publisher, subscriber, disposer, name);
|
string name) : FilterContainerNavigationViewModel(provider, factory, mediator, publisher, subscriber, disposer, name);
|
||||||
@@ -8,4 +8,4 @@ public partial class CategoriesNavigationViewModel(IServiceProvider provider,
|
|||||||
IPublisher publisher,
|
IPublisher publisher,
|
||||||
ISubscriber subscriber,
|
ISubscriber subscriber,
|
||||||
IDisposer disposer,
|
IDisposer disposer,
|
||||||
string name) : FilterVaultNavigationViewModel(provider, factory, mediator, publisher, subscriber, disposer, name);
|
string name) : FilterContainerNavigationViewModel(provider, factory, mediator, publisher, subscriber, disposer, name);
|
||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace Bitvault;
|
namespace Bitvault;
|
||||||
|
|
||||||
public partial class DeleteVaultContentActionViewModel(IServiceProvider provider,
|
public partial class ConfirmItemActionViewModel(IServiceProvider provider,
|
||||||
IServiceFactory factory,
|
IServiceFactory factory,
|
||||||
IMediator mediator,
|
IMediator mediator,
|
||||||
IPublisher publisher,
|
IPublisher publisher,
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
namespace Bitvault;
|
namespace Bitvault;
|
||||||
|
|
||||||
public class VaultStorageConnection(string connection)
|
public class ContaienrConnection(string connection)
|
||||||
{
|
{
|
||||||
private readonly string connection = connection;
|
private readonly string connection = connection;
|
||||||
|
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace Bitvault;
|
namespace Bitvault;
|
||||||
|
|
||||||
public record Vault<TValue>(TValue? Value = default);
|
public record SecureStorage<TValue>(TValue? Value = default);
|
||||||
|
|
||||||
public record Vault
|
public record Vault
|
||||||
{
|
{
|
||||||
@@ -18,9 +18,9 @@ public record Vault
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static Vault<TValue> As<TValue>(TValue value) => new(value);
|
public static SecureStorage<TValue> As<TValue>(TValue value) => new(value);
|
||||||
|
|
||||||
public static Vault<TValue> As<TValue>() where TValue : new() => new(new TValue());
|
public static SecureStorage<TValue> As<TValue>() where TValue : new() => new(new TValue());
|
||||||
|
|
||||||
|
|
||||||
[MaybeNull]
|
[MaybeNull]
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
using Toolkit.Foundation;
|
||||||
|
|
||||||
|
namespace Bitvault;
|
||||||
|
|
||||||
|
public class ContainerCollectionInitializer(IEnumerable<IConfigurationDescriptor<ContainerConfiguration>> configurations,
|
||||||
|
IComponentFactory componentFactory,
|
||||||
|
IContainerHostCollection vaults) : IInitializer
|
||||||
|
{
|
||||||
|
public async Task Initialize()
|
||||||
|
{
|
||||||
|
foreach (IConfigurationDescriptor<ContainerConfiguration> configuration in configurations)
|
||||||
|
{
|
||||||
|
if (componentFactory.Create<IContainerComponent, ContainerConfiguration>(configuration.Section, configuration.Value) is IComponentHost host)
|
||||||
|
{
|
||||||
|
vaults.Add(host);
|
||||||
|
await host.StartAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
using Toolkit.Foundation;
|
||||||
|
|
||||||
|
namespace Bitvault;
|
||||||
|
|
||||||
|
public class ContainerComponent(IComponentBuilder builder) : Component(builder),
|
||||||
|
IContainerComponent
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
using Toolkit.Foundation;
|
||||||
|
|
||||||
|
namespace Bitvault;
|
||||||
|
|
||||||
|
public class ContainerComponentFactory(IComponentFactory componentFactory) :
|
||||||
|
IContainerComponentFactory
|
||||||
|
{
|
||||||
|
public IComponentHost? Create(string name)
|
||||||
|
{
|
||||||
|
if (componentFactory.Create<IContainerComponent, ContainerConfiguration>($"Vault:{name}",
|
||||||
|
new ContainerConfiguration { Name = name }) is IComponentHost host)
|
||||||
|
{
|
||||||
|
return host;
|
||||||
|
}
|
||||||
|
|
||||||
|
return default;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace Bitvault;
|
namespace Bitvault;
|
||||||
|
|
||||||
public record VaultConfiguration : ComponentConfiguration
|
public record ContainerConfiguration : ComponentConfiguration
|
||||||
{
|
{
|
||||||
public string? Name { get; set; }
|
public string? Name { get; set; }
|
||||||
|
|
||||||
@@ -6,15 +6,15 @@ using Toolkit.Foundation;
|
|||||||
|
|
||||||
namespace Bitvault;
|
namespace Bitvault;
|
||||||
|
|
||||||
public class VaultStorage(IContainer<VaultStorageConnection> connection,
|
public class ContainerFactory(IContainer<ContaienrConnection> connection,
|
||||||
IHostEnvironment environment,
|
IHostEnvironment environment,
|
||||||
IServiceProvider provider) :
|
IServiceProvider provider) :
|
||||||
IVaultStorage
|
IContainer
|
||||||
{
|
{
|
||||||
public async Task<bool> Create(string name,
|
public async Task<bool> Create(string name,
|
||||||
VaultKey key)
|
SecurityKey key)
|
||||||
{
|
{
|
||||||
connection.Set(new VaultStorageConnection($"Data Source={Path.Combine(environment.ContentRootPath, name)}" +
|
connection.Set(new ContaienrConnection($"Data Source={Path.Combine(environment.ContentRootPath, name)}" +
|
||||||
$".vault;Mode=ReadWriteCreate;Pooling=false;Password={Convert.ToBase64String(key.DecryptedKey)}"));
|
$".vault;Mode=ReadWriteCreate;Pooling=false;Password={Convert.ToBase64String(key.DecryptedKey)}"));
|
||||||
|
|
||||||
IDbContextFactory<VaultDbContext> dbContextFactory = provider.GetRequiredService<IDbContextFactory<VaultDbContext>>();
|
IDbContextFactory<VaultDbContext> dbContextFactory = provider.GetRequiredService<IDbContextFactory<VaultDbContext>>();
|
||||||
@@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
namespace Bitvault;
|
namespace Bitvault;
|
||||||
|
|
||||||
public partial class VaultHeaderViewModel : ObservableCollectionViewModel<string, IDisposable>,
|
public partial class ContainerHeaderViewModel : ObservableCollectionViewModel<string, IDisposable>,
|
||||||
INotificationHandler<Vault<Filter<string>>>
|
INotificationHandler<SecureStorage<Filter<string>>>
|
||||||
{
|
{
|
||||||
public VaultHeaderViewModel(IServiceProvider provider,
|
public ContainerHeaderViewModel(IServiceProvider provider,
|
||||||
IServiceFactory factory,
|
IServiceFactory factory,
|
||||||
IMediator mediator,
|
IMediator mediator,
|
||||||
IPublisher publisher,
|
IPublisher publisher,
|
||||||
@@ -15,12 +15,12 @@ public partial class VaultHeaderViewModel : ObservableCollectionViewModel<string
|
|||||||
{
|
{
|
||||||
Template = template;
|
Template = template;
|
||||||
|
|
||||||
Add<AddVaultContentActionViewModel>();
|
Add<AddItemActionViewModel>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IContentTemplate Template { get; set; }
|
public IContentTemplate Template { get; set; }
|
||||||
|
|
||||||
public Task Handle(Vault<Filter<string>> args,
|
public Task Handle(SecureStorage<Filter<string>> args,
|
||||||
CancellationToken cancellationToken = default)
|
CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
if (args.Value is Filter<string> filter)
|
if (args.Value is Filter<string> filter)
|
||||||
@@ -3,8 +3,8 @@ using Toolkit.Foundation;
|
|||||||
|
|
||||||
namespace Bitvault;
|
namespace Bitvault;
|
||||||
|
|
||||||
public class VaultHostCollection :
|
public class ContainerHostCollection :
|
||||||
IVaultHostCollection
|
IContainerHostCollection
|
||||||
|
|
||||||
{
|
{
|
||||||
private readonly List<IComponentHost> hosts = [];
|
private readonly List<IComponentHost> hosts = [];
|
||||||
@@ -3,13 +3,13 @@ using Toolkit.Foundation;
|
|||||||
|
|
||||||
namespace Bitvault;
|
namespace Bitvault;
|
||||||
|
|
||||||
public partial class VaultNavigationViewModel :
|
public partial class ContainerNavigationViewModel :
|
||||||
ObservableCollectionViewModel<IVaultNavigationViewModel>,
|
ObservableCollectionViewModel<IContainerNavigationViewModel>,
|
||||||
IMainNavigationViewModel,
|
IMainNavigationViewModel,
|
||||||
INotificationHandler<Vault<Opened>>,
|
INotificationHandler<SecureStorage<Opened>>,
|
||||||
INotificationHandler<Vault<Closed>>,
|
INotificationHandler<SecureStorage<Closed>>,
|
||||||
INotificationHandler<Vault<Activated>>,
|
INotificationHandler<SecureStorage<Activated>>,
|
||||||
INotificationHandler<Vault<Deactivated>>
|
INotificationHandler<SecureStorage<Deactivated>>
|
||||||
{
|
{
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
private bool activated;
|
private bool activated;
|
||||||
@@ -26,7 +26,7 @@ public partial class VaultNavigationViewModel :
|
|||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
private bool selected;
|
private bool selected;
|
||||||
|
|
||||||
public VaultNavigationViewModel(IServiceProvider provider,
|
public ContainerNavigationViewModel(IServiceProvider provider,
|
||||||
IServiceFactory factory,
|
IServiceFactory factory,
|
||||||
IMediator mediator,
|
IMediator mediator,
|
||||||
IPublisher publisher,
|
IPublisher publisher,
|
||||||
@@ -41,7 +41,7 @@ public partial class VaultNavigationViewModel :
|
|||||||
|
|
||||||
public IContentTemplate Template { get; set; }
|
public IContentTemplate Template { get; set; }
|
||||||
|
|
||||||
public Task Handle(Vault<Opened> args,
|
public Task Handle(SecureStorage<Opened> args,
|
||||||
CancellationToken cancellationToken = default)
|
CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
Add<AllNavigationViewModel>("All");
|
Add<AllNavigationViewModel>("All");
|
||||||
@@ -53,7 +53,7 @@ public partial class VaultNavigationViewModel :
|
|||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task Handle(Vault<Closed> args,
|
public Task Handle(SecureStorage<Closed> args,
|
||||||
CancellationToken cancellationToken = default)
|
CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
Opened = true;
|
Opened = true;
|
||||||
@@ -62,11 +62,11 @@ public partial class VaultNavigationViewModel :
|
|||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task Handle(Vault<Deactivated> args,
|
public Task Handle(SecureStorage<Deactivated> args,
|
||||||
CancellationToken cancellationToken = default) =>
|
CancellationToken cancellationToken = default) =>
|
||||||
Task.FromResult(Activated = false);
|
Task.FromResult(Activated = false);
|
||||||
|
|
||||||
public Task Handle(Vault<Activated> args,
|
public Task Handle(SecureStorage<Activated> args,
|
||||||
CancellationToken cancellationToken = default) =>
|
CancellationToken cancellationToken = default) =>
|
||||||
Task.FromResult(Activated = true);
|
Task.FromResult(Activated = true);
|
||||||
}
|
}
|
||||||
@@ -4,8 +4,8 @@ using Toolkit.Foundation;
|
|||||||
namespace Bitvault;
|
namespace Bitvault;
|
||||||
|
|
||||||
|
|
||||||
[Enumerate(nameof(VaultViewModel))]
|
[Enumerate(nameof(ContainerViewModel))]
|
||||||
public partial class VaultViewModel(IServiceProvider provider,
|
public partial class ContainerViewModel(IServiceProvider provider,
|
||||||
IServiceFactory factory,
|
IServiceFactory factory,
|
||||||
IMediator mediator,
|
IMediator mediator,
|
||||||
IPublisher publisher,
|
IPublisher publisher,
|
||||||
@@ -13,8 +13,8 @@ public partial class VaultViewModel(IServiceProvider provider,
|
|||||||
IDisposer disposer,
|
IDisposer disposer,
|
||||||
IContentTemplate template,
|
IContentTemplate template,
|
||||||
NamedComponent named,
|
NamedComponent named,
|
||||||
string? filter = null) : ObservableCollectionViewModel<VaultContentNavigationViewModel>(provider, factory, mediator, publisher, subscriber, disposer),
|
string? filter = null) : ObservableCollectionViewModel<ItemNavigationViewModel>(provider, factory, mediator, publisher, subscriber, disposer),
|
||||||
INotificationHandler<Vault<Filter<string>>>
|
INotificationHandler<SecureStorage<Filter<string>>>
|
||||||
{
|
{
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
private string? filter = filter;
|
private string? filter = filter;
|
||||||
@@ -36,7 +36,7 @@ public partial class VaultViewModel(IServiceProvider provider,
|
|||||||
await base.Deactivated();
|
await base.Deactivated();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task Handle(Vault<Filter<string>> args,
|
public async Task Handle(SecureStorage<Filter<string>> args,
|
||||||
CancellationToken cancellationToken = default)
|
CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
if (args.Value is Filter<string> filter)
|
if (args.Value is Filter<string> filter)
|
||||||
@@ -47,5 +47,5 @@ public partial class VaultViewModel(IServiceProvider provider,
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected override IEnumerate PrepareEnumeration(object? key) =>
|
protected override IEnumerate PrepareEnumeration(object? key) =>
|
||||||
Enumerate<VaultContentNavigationViewModel>.With(new VaultViewModelOptions { Filter = Filter }) with { Key = key };
|
Enumerate<ItemNavigationViewModel>.With(new ContainerViewModelConfiguration { Filter = Filter }) with { Key = key };
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
namespace Bitvault;
|
namespace Bitvault;
|
||||||
|
|
||||||
public record VaultViewModelOptions
|
public record ContainerViewModelConfiguration
|
||||||
{
|
{
|
||||||
public string? Filter { get; set; }
|
public string? Filter { get; set; }
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
using Toolkit.Foundation;
|
||||||
|
|
||||||
|
namespace Bitvault;
|
||||||
|
|
||||||
|
public class ContainerViewModelHandler(IServiceFactory factory,
|
||||||
|
IPublisher publisher) :
|
||||||
|
INotificationHandler<Enumerate<ItemNavigationViewModel, ContainerViewModelConfiguration>>
|
||||||
|
{
|
||||||
|
public async Task Handle(Enumerate<ItemNavigationViewModel, ContainerViewModelConfiguration> args,
|
||||||
|
CancellationToken cancellationToken = default)
|
||||||
|
{
|
||||||
|
if (args.Options?.Filter is "All")
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 100; i++)
|
||||||
|
{
|
||||||
|
if (factory.Create<ItemNavigationViewModel>("Name " + i, "Description " + 1) is ItemNavigationViewModel viewModel)
|
||||||
|
{
|
||||||
|
await publisher.Publish(new Create<ItemNavigationViewModel>(viewModel),
|
||||||
|
nameof(ContainerViewModel), cancellationToken);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.Options?.Filter is "Starred")
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 10; i++)
|
||||||
|
{
|
||||||
|
if (factory.Create<ItemNavigationViewModel>("Name " + i, "Description " + 1) is ItemNavigationViewModel viewModel)
|
||||||
|
{
|
||||||
|
await publisher.Publish(new Create<ItemNavigationViewModel>(viewModel),
|
||||||
|
nameof(ContainerViewModel), cancellationToken);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.Options?.Filter is "Archive")
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 1000; i++)
|
||||||
|
{
|
||||||
|
if (factory.Create<ItemNavigationViewModel>("Name " + i, "Description " + 1) is ItemNavigationViewModel viewModel)
|
||||||
|
{
|
||||||
|
await publisher.Publish(new Create<ItemNavigationViewModel>(viewModel),
|
||||||
|
nameof(ContainerViewModel), cancellationToken);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,7 +5,7 @@ using Toolkit.Foundation;
|
|||||||
|
|
||||||
namespace Bitvault;
|
namespace Bitvault;
|
||||||
|
|
||||||
public class CreateVaultHandler(IVaultComponentFactory componentFactory) :
|
public class CreateContainerHandler(IContainerComponentFactory componentFactory) :
|
||||||
IHandler<Create<Vault>, bool>
|
IHandler<Create<Vault>, bool>
|
||||||
{
|
{
|
||||||
public async Task<bool> Handle(Create<Vault> args,
|
public async Task<bool> Handle(Create<Vault> args,
|
||||||
@@ -16,18 +16,18 @@ public class CreateVaultHandler(IVaultComponentFactory componentFactory) :
|
|||||||
{
|
{
|
||||||
if (componentFactory.Create(name) is IComponentHost host)
|
if (componentFactory.Create(name) is IComponentHost host)
|
||||||
{
|
{
|
||||||
IVaultKeyFactory keyVaultFactory = host.Services.GetRequiredService<IVaultKeyFactory>();
|
ISecurityKeyFactory keyVaultFactory = host.Services.GetRequiredService<ISecurityKeyFactory>();
|
||||||
IContainer<VaultKey> vaultKeyContainer = host.Services.GetRequiredService<IContainer<VaultKey>>();
|
IContainer<SecurityKey> vaultKeyContainer = host.Services.GetRequiredService<IContainer<SecurityKey>>();
|
||||||
IVaultStorage vaultStorage = host.Services.GetRequiredService<IVaultStorage>();
|
IContainer vaultStorage = host.Services.GetRequiredService<IContainer>();
|
||||||
|
|
||||||
if (keyVaultFactory.Create(Encoding.UTF8.GetBytes(password)) is VaultKey key)
|
if (keyVaultFactory.Create(Encoding.UTF8.GetBytes(password)) is SecurityKey key)
|
||||||
{
|
{
|
||||||
vaultKeyContainer.Set(key);
|
vaultKeyContainer.Set(key);
|
||||||
|
|
||||||
if (await vaultStorage.Create(name, key))
|
if (await vaultStorage.Create(name, key))
|
||||||
{
|
{
|
||||||
IWritableConfiguration<VaultConfiguration> configuration =
|
IWritableConfiguration<ContainerConfiguration> configuration =
|
||||||
host.Services.GetRequiredService<IWritableConfiguration<VaultConfiguration>>();
|
host.Services.GetRequiredService<IWritableConfiguration<ContainerConfiguration>>();
|
||||||
|
|
||||||
configuration.Write(args => args.Key = $"{Convert.ToBase64String(key.Salt)}:{Convert.ToBase64String(key.EncryptedKey)}:{Convert.ToBase64String(key.DecryptedKey)}");
|
configuration.Write(args => args.Key = $"{Convert.ToBase64String(key.Salt)}:{Convert.ToBase64String(key.EncryptedKey)}:{Convert.ToBase64String(key.DecryptedKey)}");
|
||||||
host.Start();
|
host.Start();
|
||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace Bitvault;
|
namespace Bitvault;
|
||||||
|
|
||||||
public partial class CreateVaultNavigationViewModel(IServiceProvider provider,
|
public partial class CreateContainerNavigationViewModel(IServiceProvider provider,
|
||||||
IServiceFactory factory,
|
IServiceFactory factory,
|
||||||
IMediator mediator,
|
IMediator mediator,
|
||||||
IPublisher publisher,
|
IPublisher publisher,
|
||||||
@@ -4,7 +4,7 @@ using Toolkit.Foundation;
|
|||||||
|
|
||||||
namespace Bitvault;
|
namespace Bitvault;
|
||||||
|
|
||||||
public partial class CreateVaultViewModel(IServiceProvider provider,
|
public partial class CreateContainerViewModel(IServiceProvider provider,
|
||||||
IServiceFactory factory,
|
IServiceFactory factory,
|
||||||
IPublisher publisher,
|
IPublisher publisher,
|
||||||
IMediator mediator,
|
IMediator mediator,
|
||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace Bitvault;
|
namespace Bitvault;
|
||||||
|
|
||||||
public partial class ConfirmVaultContentActionViewModel(IServiceProvider provider,
|
public partial class DeleteItemActionViewModel(IServiceProvider provider,
|
||||||
IServiceFactory factory,
|
IServiceFactory factory,
|
||||||
IMediator mediator,
|
IMediator mediator,
|
||||||
IPublisher publisher,
|
IPublisher publisher,
|
||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace Bitvault;
|
namespace Bitvault;
|
||||||
|
|
||||||
public partial class DismissVaultContentActionViewModel(IServiceProvider provider,
|
public partial class DismissItemActionViewModel(IServiceProvider provider,
|
||||||
IServiceFactory factory,
|
IServiceFactory factory,
|
||||||
IMediator mediator,
|
IMediator mediator,
|
||||||
IPublisher publisher,
|
IPublisher publisher,
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace Bitvault;
|
namespace Bitvault;
|
||||||
|
|
||||||
public partial class EditVaultContentActionViewModel(IServiceProvider provider,
|
public partial class EditItemActionViewModel(IServiceProvider provider,
|
||||||
IServiceFactory factory,
|
IServiceFactory factory,
|
||||||
IMediator mediator,
|
IMediator mediator,
|
||||||
IPublisher publisher,
|
IPublisher publisher,
|
||||||
+7
-7
@@ -4,10 +4,10 @@ using Toolkit.Foundation;
|
|||||||
|
|
||||||
namespace Bitvault;
|
namespace Bitvault;
|
||||||
|
|
||||||
public partial class FilterVaultNavigationViewModel : ObservableViewModel,
|
public partial class FilterContainerNavigationViewModel : ObservableViewModel,
|
||||||
IVaultNavigationViewModel,
|
IContainerNavigationViewModel,
|
||||||
INotificationHandler<Vault<Activated>>,
|
INotificationHandler<SecureStorage<Activated>>,
|
||||||
INotificationHandler<Vault<Deactivated>>
|
INotificationHandler<SecureStorage<Deactivated>>
|
||||||
{
|
{
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
private bool activated;
|
private bool activated;
|
||||||
@@ -18,7 +18,7 @@ public partial class FilterVaultNavigationViewModel : ObservableViewModel,
|
|||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
private bool selected;
|
private bool selected;
|
||||||
|
|
||||||
public FilterVaultNavigationViewModel(IServiceProvider provider,
|
public FilterContainerNavigationViewModel(IServiceProvider provider,
|
||||||
IServiceFactory factory,
|
IServiceFactory factory,
|
||||||
IMediator mediator,
|
IMediator mediator,
|
||||||
IPublisher publisher,
|
IPublisher publisher,
|
||||||
@@ -29,11 +29,11 @@ public partial class FilterVaultNavigationViewModel : ObservableViewModel,
|
|||||||
Filter = filter;
|
Filter = filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task Handle(Vault<Deactivated> args,
|
public Task Handle(SecureStorage<Deactivated> args,
|
||||||
CancellationToken cancellationToken = default) =>
|
CancellationToken cancellationToken = default) =>
|
||||||
Task.FromResult(Activated = false);
|
Task.FromResult(Activated = false);
|
||||||
|
|
||||||
public Task Handle(Vault<Activated> args,
|
public Task Handle(SecureStorage<Activated> args,
|
||||||
CancellationToken cancellationToken = default) =>
|
CancellationToken cancellationToken = default) =>
|
||||||
Task.FromResult(Activated = true);
|
Task.FromResult(Activated = true);
|
||||||
|
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
namespace Bitvault;
|
||||||
|
|
||||||
|
public interface IContainer
|
||||||
|
{
|
||||||
|
Task<bool> Create(string name, SecurityKey key);
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
using Toolkit.Foundation;
|
||||||
|
|
||||||
|
namespace Bitvault;
|
||||||
|
|
||||||
|
public interface IContainerComponent : IComponent;
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace Bitvault
|
namespace Bitvault
|
||||||
{
|
{
|
||||||
public interface IVaultComponentFactory
|
public interface IContainerComponentFactory
|
||||||
{
|
{
|
||||||
IComponentHost? Create(string name);
|
IComponentHost? Create(string name);
|
||||||
}
|
}
|
||||||
@@ -2,4 +2,4 @@
|
|||||||
|
|
||||||
namespace Bitvault;
|
namespace Bitvault;
|
||||||
|
|
||||||
public interface IVaultHost : IComponentHost;
|
public interface IContainerHost : IComponentHost;
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace Bitvault;
|
namespace Bitvault;
|
||||||
|
|
||||||
public interface IVaultHostCollection :
|
public interface IContainerHostCollection :
|
||||||
IEnumerable<IComponentHost>
|
IEnumerable<IComponentHost>
|
||||||
{
|
{
|
||||||
void Add(IComponentHost host);
|
void Add(IComponentHost host);
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
using Toolkit.Foundation;
|
||||||
|
|
||||||
|
namespace Bitvault;
|
||||||
|
|
||||||
|
public interface IContainerNavigationViewModel : ISelectable;
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
using Toolkit.Foundation;
|
||||||
|
|
||||||
|
namespace Bitvault;
|
||||||
|
|
||||||
|
public interface IItemViewModel :
|
||||||
|
IValueInvoker<ItemConfiguration>;
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
namespace Bitvault;
|
namespace Bitvault;
|
||||||
|
|
||||||
public interface IVaultKeyFactory
|
public interface ISecurityKeyFactory
|
||||||
{
|
{
|
||||||
VaultKey? Create(byte[] phrase,
|
SecurityKey? Create(byte[] phrase,
|
||||||
byte[]? encryptedKey = null,
|
byte[]? encryptedKey = null,
|
||||||
byte[]? salt = null);
|
byte[]? salt = null);
|
||||||
}
|
}
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
using Toolkit.Foundation;
|
|
||||||
|
|
||||||
namespace Bitvault;
|
|
||||||
|
|
||||||
public interface IVaultComponent : IComponent;
|
|
||||||
|
|
||||||
public class VaultComponent(IComponentBuilder builder) : Component(builder),
|
|
||||||
IVaultComponent
|
|
||||||
{
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
namespace Bitvault
|
|
||||||
{
|
|
||||||
public interface IVaultConnectionPersistence
|
|
||||||
{
|
|
||||||
void Dispose();
|
|
||||||
string? Get(string key);
|
|
||||||
void Set(string key, string connection);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
using Toolkit.Foundation;
|
|
||||||
|
|
||||||
namespace Bitvault;
|
|
||||||
|
|
||||||
public interface IVaultContentEntryViewModel :
|
|
||||||
IValueInvoker<VaultContentConfiguration>;
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
using Toolkit.Foundation;
|
|
||||||
|
|
||||||
namespace Bitvault;
|
|
||||||
|
|
||||||
public interface IVaultNavigationViewModel : ISelectable;
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
namespace Bitvault;
|
|
||||||
|
|
||||||
public interface IVaultStorage
|
|
||||||
{
|
|
||||||
Task<bool> Create(string name, VaultKey key);
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
namespace Bitvault;
|
namespace Bitvault;
|
||||||
|
|
||||||
public record VaultContentConfiguration
|
public record ItemConfiguration
|
||||||
{
|
{
|
||||||
public string? Name { get; set; }
|
public string? Name { get; set; }
|
||||||
}
|
}
|
||||||
@@ -2,14 +2,14 @@
|
|||||||
|
|
||||||
namespace Bitvault;
|
namespace Bitvault;
|
||||||
|
|
||||||
public partial class VaultContentHeaderViewModel(IServiceProvider provider,
|
public partial class ItemHeaderViewModel(IServiceProvider provider,
|
||||||
IServiceFactory factory,
|
IServiceFactory factory,
|
||||||
IMediator mediator,
|
IMediator mediator,
|
||||||
IPublisher publisher,
|
IPublisher publisher,
|
||||||
ISubscriber subscriber,
|
ISubscriber subscriber,
|
||||||
IDisposer disposer) : ObservableViewModel<string, string>(provider, factory, mediator, publisher, subscriber, disposer),
|
IDisposer disposer) : ObservableViewModel<string, string>(provider, factory, mediator, publisher, subscriber, disposer),
|
||||||
IVaultContentEntryViewModel
|
IItemViewModel
|
||||||
{
|
{
|
||||||
public void Invoke(VaultContentConfiguration args) =>
|
public void Invoke(ItemConfiguration args) =>
|
||||||
args.Name = Value;
|
args.Name = Value;
|
||||||
}
|
}
|
||||||
@@ -3,7 +3,7 @@ using Toolkit.Foundation;
|
|||||||
|
|
||||||
namespace Bitvault;
|
namespace Bitvault;
|
||||||
|
|
||||||
public partial class VaultContentNavigationViewModel(IServiceProvider provider,
|
public partial class ItemNavigationViewModel(IServiceProvider provider,
|
||||||
IServiceFactory factory,
|
IServiceFactory factory,
|
||||||
IMediator mediator,
|
IMediator mediator,
|
||||||
IPublisher publisher,
|
IPublisher publisher,
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace Bitvault;
|
namespace Bitvault;
|
||||||
|
|
||||||
public class VaultContentViewModel(IServiceProvider provider,
|
public class ItemViewModel(IServiceProvider provider,
|
||||||
IServiceFactory factory,
|
IServiceFactory factory,
|
||||||
IMediator mediator,
|
IMediator mediator,
|
||||||
IPublisher publisher,
|
IPublisher publisher,
|
||||||
@@ -4,7 +4,7 @@ using Toolkit.Foundation;
|
|||||||
namespace Bitvault;
|
namespace Bitvault;
|
||||||
|
|
||||||
public class MainViewModelHandler(IPublisher publisher,
|
public class MainViewModelHandler(IPublisher publisher,
|
||||||
IVaultHostCollection vaults) :
|
IContainerHostCollection vaults) :
|
||||||
INotificationHandler<Enumerate<IMainNavigationViewModel>>
|
INotificationHandler<Enumerate<IMainNavigationViewModel>>
|
||||||
{
|
{
|
||||||
public async Task Handle(Enumerate<IMainNavigationViewModel> args,
|
public async Task Handle(Enumerate<IMainNavigationViewModel> args,
|
||||||
@@ -12,11 +12,11 @@ public class MainViewModelHandler(IPublisher publisher,
|
|||||||
{
|
{
|
||||||
foreach (IComponentHost vault in vaults)
|
foreach (IComponentHost vault in vaults)
|
||||||
{
|
{
|
||||||
if (vault.Services.GetRequiredService<VaultConfiguration>() is VaultConfiguration configuration)
|
if (vault.Services.GetRequiredService<ContainerConfiguration>() is ContainerConfiguration configuration)
|
||||||
{
|
{
|
||||||
if (vault.Services.GetRequiredService<IServiceFactory>() is IServiceFactory factory)
|
if (vault.Services.GetRequiredService<IServiceFactory>() is IServiceFactory factory)
|
||||||
{
|
{
|
||||||
if (factory.Create<VaultNavigationViewModel>(configuration.Name) is VaultNavigationViewModel viewModel)
|
if (factory.Create<ContainerNavigationViewModel>(configuration.Name) is ContainerNavigationViewModel viewModel)
|
||||||
{
|
{
|
||||||
await publisher.Publish(new Create<IMainNavigationViewModel>(viewModel),
|
await publisher.Publish(new Create<IMainNavigationViewModel>(viewModel),
|
||||||
nameof(MainViewModel), cancellationToken);
|
nameof(MainViewModel), cancellationToken);
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public partial class ManageViewModel :
|
|||||||
{
|
{
|
||||||
Template = template;
|
Template = template;
|
||||||
|
|
||||||
Add<CreateVaultNavigationViewModel>();
|
Add<CreateContainerNavigationViewModel>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IContentTemplate Template { get; set; }
|
public IContentTemplate Template { get; set; }
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ using Toolkit.Foundation;
|
|||||||
|
|
||||||
namespace Bitvault;
|
namespace Bitvault;
|
||||||
|
|
||||||
public class OpenVaultHandler(VaultConfiguration configuration,
|
public class OpenContainerHandler(ContainerConfiguration configuration,
|
||||||
IVaultKeyFactory keyVaultFactory,
|
ISecurityKeyFactory keyVaultFactory,
|
||||||
IVaultStorage vaultStorage) :
|
IContainer vaultStorage) :
|
||||||
IHandler<Open<Vault>, bool>
|
IHandler<Open<Vault>, bool>
|
||||||
{
|
{
|
||||||
public async Task<bool> Handle(Open<Vault> args,
|
public async Task<bool> Handle(Open<Vault> args,
|
||||||
@@ -18,7 +18,7 @@ public class OpenVaultHandler(VaultConfiguration configuration,
|
|||||||
byte[]? salt = Convert.FromBase64String(keyPart[0]);
|
byte[]? salt = Convert.FromBase64String(keyPart[0]);
|
||||||
byte[]? encryptedKey = Convert.FromBase64String(keyPart[1]);
|
byte[]? encryptedKey = Convert.FromBase64String(keyPart[1]);
|
||||||
|
|
||||||
if ( keyVaultFactory.Create(Encoding.UTF8.GetBytes(password), encryptedKey, salt) is VaultKey key)
|
if ( keyVaultFactory.Create(Encoding.UTF8.GetBytes(password), encryptedKey, salt) is SecurityKey key)
|
||||||
{
|
{
|
||||||
if (await vaultStorage.Create(name, key))
|
if (await vaultStorage.Create(name, key))
|
||||||
{
|
{
|
||||||
@@ -4,7 +4,7 @@ using Toolkit.Foundation;
|
|||||||
|
|
||||||
namespace Bitvault;
|
namespace Bitvault;
|
||||||
|
|
||||||
public partial class OpenVaultViewModel(IServiceProvider provider,
|
public partial class OpenContainerViewModel(IServiceProvider provider,
|
||||||
IServiceFactory factory,
|
IServiceFactory factory,
|
||||||
IMediator mediator,
|
IMediator mediator,
|
||||||
IPublisher publisher,
|
IPublisher publisher,
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace Bitvault;
|
namespace Bitvault;
|
||||||
|
|
||||||
public partial class VaultSearchHeaderViewModel(IServiceProvider provider,
|
public partial class SearchHeaderViewModel(IServiceProvider provider,
|
||||||
IServiceFactory factory,
|
IServiceFactory factory,
|
||||||
IMediator mediator,
|
IMediator mediator,
|
||||||
IPublisher publisher,
|
IPublisher publisher,
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
namespace Bitvault;
|
namespace Bitvault;
|
||||||
|
|
||||||
public record VaultKey(byte[] Salt, byte[] EncryptedKey, byte[] DecryptedKey) :
|
public record SecurityKey(byte[] Salt, byte[] EncryptedKey, byte[] DecryptedKey) :
|
||||||
IDisposable
|
IDisposable
|
||||||
{
|
{
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
@@ -2,13 +2,13 @@
|
|||||||
|
|
||||||
namespace Bitvault;
|
namespace Bitvault;
|
||||||
|
|
||||||
public class VaultKeyFactory(IKeyGenerator generator,
|
public class SecurityKeyFactory(IKeyGenerator generator,
|
||||||
IKeyDeriver deriver,
|
IKeyDeriver deriver,
|
||||||
IEncryptor encryptor,
|
IEncryptor encryptor,
|
||||||
IDecryptor decryptor) :
|
IDecryptor decryptor) :
|
||||||
IVaultKeyFactory
|
ISecurityKeyFactory
|
||||||
{
|
{
|
||||||
public VaultKey? Create(byte[] phrase,
|
public SecurityKey? Create(byte[] phrase,
|
||||||
byte[]? encryptedKey = null,
|
byte[]? encryptedKey = null,
|
||||||
byte[]? salt = null)
|
byte[]? salt = null)
|
||||||
{
|
{
|
||||||
@@ -28,7 +28,7 @@ public class VaultKeyFactory(IKeyGenerator generator,
|
|||||||
return default;
|
return default;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new VaultKey(salt, encryptedKey, decryptedKey);
|
return new SecurityKey(salt, encryptedKey, decryptedKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -8,4 +8,4 @@ public partial class StarredNavigationViewModel(IServiceProvider provider,
|
|||||||
IPublisher publisher,
|
IPublisher publisher,
|
||||||
ISubscriber subscriber,
|
ISubscriber subscriber,
|
||||||
IDisposer disposer,
|
IDisposer disposer,
|
||||||
string name) : FilterVaultNavigationViewModel(provider, factory, mediator, publisher, subscriber, disposer, name);
|
string name) : FilterContainerNavigationViewModel(provider, factory, mediator, publisher, subscriber, disposer, name);
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
using Toolkit.Foundation;
|
|
||||||
|
|
||||||
namespace Bitvault;
|
|
||||||
|
|
||||||
public class VaultCollectionInitializer(IEnumerable<IConfigurationDescriptor<VaultConfiguration>> configurations,
|
|
||||||
IComponentFactory componentFactory,
|
|
||||||
IVaultHostCollection vaults) : IInitializer
|
|
||||||
{
|
|
||||||
public async Task Initialize()
|
|
||||||
{
|
|
||||||
foreach (IConfigurationDescriptor<VaultConfiguration> configuration in configurations)
|
|
||||||
{
|
|
||||||
if (componentFactory.Create<IVaultComponent, VaultConfiguration>(configuration.Section, configuration.Value) is IComponentHost host)
|
|
||||||
{
|
|
||||||
vaults.Add(host);
|
|
||||||
await host.StartAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
using Toolkit.Foundation;
|
|
||||||
|
|
||||||
namespace Bitvault;
|
|
||||||
|
|
||||||
public class VaultComponentFactory(IComponentFactory componentFactory) :
|
|
||||||
IVaultComponentFactory
|
|
||||||
{
|
|
||||||
public IComponentHost? Create(string name)
|
|
||||||
{
|
|
||||||
if (componentFactory.Create<IVaultComponent, VaultConfiguration>($"Vault:{name}",
|
|
||||||
new VaultConfiguration { Name = name }) is IComponentHost host)
|
|
||||||
{
|
|
||||||
return host;
|
|
||||||
}
|
|
||||||
|
|
||||||
return default;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user