Ensure containers show up in the menu when they are created
This commit is contained in:
@@ -15,9 +15,13 @@
|
||||
ToolTip.Tip="Add item">
|
||||
<Interaction.Behaviors>
|
||||
<EventTriggerBehavior EventName="Click">
|
||||
<NavigateAction
|
||||
Context="{Binding Named, StringFormat='{}{0}:ContentHeader'}"
|
||||
Route="ItemCommandHeader"
|
||||
Scope="self" />
|
||||
<NavigateAction
|
||||
Context="{Binding Named, StringFormat='{}{0}:Content'}"
|
||||
Route="AddItem"
|
||||
Route="Item"
|
||||
Scope="self" />
|
||||
</EventTriggerBehavior>
|
||||
</Interaction.Behaviors>
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace Bitvault.Avalonia;
|
||||
|
||||
public partial class AddItemCommandHeaderView : UserControl
|
||||
{
|
||||
public AddItemCommandHeaderView() => InitializeComponent();
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
<UserControl
|
||||
x:Class="Bitvault.Avalonia.AddItemView"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="using:Bitvault"
|
||||
x:DataType="vm:AddItemViewModel">
|
||||
<Interaction.Behaviors>
|
||||
<EventTriggerBehavior EventName="Loaded">
|
||||
<NavigateAction
|
||||
Context="{Binding Named, StringFormat='{}{0}:ContentHeader'}"
|
||||
Route="AddVaultContentCommandHeader"
|
||||
Scope="self" />
|
||||
</EventTriggerBehavior>
|
||||
</Interaction.Behaviors>
|
||||
<ScrollViewer Padding="12,12,12,0">
|
||||
<ItemsControl ItemTemplate="{ReflectionBinding Template}" ItemsSource="{Binding}" />
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
@@ -1,8 +0,0 @@
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace Bitvault.Avalonia;
|
||||
|
||||
public partial class AddItemView : UserControl
|
||||
{
|
||||
public AddItemView() => InitializeComponent();
|
||||
}
|
||||
@@ -35,6 +35,8 @@ public partial class App : Application
|
||||
services.AddTemplate<MainWindowViewModel, MainWindow>("MainWindow");
|
||||
}
|
||||
|
||||
services.AddHandler<ContainerActivatedHandler>();
|
||||
|
||||
services.AddTransient<IContainerComponent> (provider => Component.Create<ContainerComponent>(provider, args =>
|
||||
{
|
||||
args.AddServices(services =>
|
||||
@@ -47,14 +49,14 @@ public partial class App : Application
|
||||
services.AddTransient<IKeyDeriver, KeyDeriver>();
|
||||
|
||||
services.AddTransient<ISecurityKeyFactory, SecurityKeyFactory>();
|
||||
services.AddTransient<IContainer, ContainerFactory>();
|
||||
services.TryAddSingleton<IContainer<SecurityKey>, Container<SecurityKey>>();
|
||||
services.TryAddSingleton<IContainer<ContainerConnection>, Container<ContainerConnection>>();
|
||||
services.AddTransient<IContainerFactory, ContainerFactory>();
|
||||
services.TryAddSingleton<IValueStore<SecurityKey>, ValueStore<SecurityKey>>();
|
||||
services.TryAddSingleton<IValueStore<ContainerConnection>, ValueStore<ContainerConnection>>();
|
||||
|
||||
services.AddDbContextFactory<ContainerDbContext>((provider, args) =>
|
||||
{
|
||||
if (provider.GetRequiredService<IContainer<ContainerConnection>>()
|
||||
is IContainer<ContainerConnection> connection)
|
||||
if (provider.GetRequiredService<IValueStore<ContainerConnection>>()
|
||||
is IValueStore<ContainerConnection> connection)
|
||||
{
|
||||
args.UseSqlite($"{connection.Value}");
|
||||
}
|
||||
@@ -80,8 +82,7 @@ public partial class App : Application
|
||||
services.AddTemplate<ItemNavigationViewModel, ItemNavigationView>();
|
||||
services.AddTemplate<ItemViewModel, ItemView>("Item");
|
||||
|
||||
services.AddTemplate<AddItemViewModel, AddItemView>("AddItem");
|
||||
services.AddTemplate<AddItemCommandHeaderViewModel, AddItemCommandHeaderView>("AddVaultContentCommandHeader");
|
||||
services.AddTemplate<ItemCommandHeaderViewModel, ItemCommandHeaderView>("ItemCommandHeader");
|
||||
|
||||
services.AddTemplate<ConfirmItemActionViewModel, ConfirmItemActionView>();
|
||||
services.AddTemplate<DismissItemActionViewModel, DismissItemActionView>();
|
||||
|
||||
@@ -43,11 +43,8 @@
|
||||
<Compile Update="AddItemActionView.axaml.cs">
|
||||
<DependentUpon>AddItemActionView.axaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="AddItemCommandHeaderView.axaml.cs">
|
||||
<DependentUpon>AddItemCommandHeaderView.axaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="AddItemView.axaml.cs">
|
||||
<DependentUpon>AddItemView.axaml</DependentUpon>
|
||||
<Compile Update="ItemCommandHeaderView.axaml.cs">
|
||||
<DependentUpon>ItemCommandHeaderView.axaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="ConfirmItemActionView.axaml.cs">
|
||||
<DependentUpon>ConfirmItemActionView.axaml</DependentUpon>
|
||||
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
<UserControl
|
||||
x:Class="Bitvault.Avalonia.AddItemCommandHeaderView"
|
||||
x:Class="Bitvault.Avalonia.ItemCommandHeaderView"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="using:Bitvault"
|
||||
x:DataType="vm:AddItemCommandHeaderViewModel">
|
||||
x:DataType="vm:ItemCommandHeaderViewModel">
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<x:Double x:Key="ButtonWidth">40</x:Double>
|
||||
@@ -0,0 +1,8 @@
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace Bitvault.Avalonia;
|
||||
|
||||
public partial class ItemCommandHeaderView : UserControl
|
||||
{
|
||||
public ItemCommandHeaderView() => InitializeComponent();
|
||||
}
|
||||
@@ -3,15 +3,22 @@
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="using:Bitvault"
|
||||
x:Name="Name"
|
||||
x:CompileBindings="False"
|
||||
x:DataType="vm:ItemNavigationViewModel">
|
||||
<Interaction.Behaviors>
|
||||
<DataTriggerBehavior Binding="{Binding Selected}" Value="True">
|
||||
<NavigateAction Context="{Binding Named, StringFormat='{}{0}:Content'}" Route="Item" />
|
||||
<NavigateAction
|
||||
Context="{Binding Named, StringFormat='{}{0}:ContentHeader'}"
|
||||
Route="ItemCommandHeader"
|
||||
Scope="self" />
|
||||
<NavigateAction Context="{Binding Named, StringFormat='{}{0}:Content'}" Route="Item">
|
||||
<NavigateAction.ParameterBindings>
|
||||
<ParameterBinding Key="Id" Value="{Binding Id}" />
|
||||
<ParameterBinding Key="Name" Value="{Binding Name}" />
|
||||
</NavigateAction.ParameterBindings>
|
||||
</NavigateAction>
|
||||
</DataTriggerBehavior>
|
||||
</Interaction.Behaviors>
|
||||
<Grid ColumnDefinitions="Auto,*">
|
||||
<Grid Background="Transparent" ColumnDefinitions="Auto,*">
|
||||
<PersonPicture
|
||||
Grid.Column="0"
|
||||
Height="34"
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
<UserControl
|
||||
x:Class="Bitvault.Avalonia.ItemView"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
Vault content placeholder
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="using:Bitvault"
|
||||
x:DataType="vm:ItemViewModel">
|
||||
<ScrollViewer Padding="12,12,12,0">
|
||||
<ItemsControl ItemTemplate="{ReflectionBinding Template}" ItemsSource="{Binding}" />
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
|
||||
Reference in New Issue
Block a user