Prototyping
This commit is contained in:
+2
-2
@@ -1,9 +1,9 @@
|
||||
<UserControl
|
||||
x:Class="Bitvault.Avalonia.AddVaultContentHeaderView"
|
||||
x:Class="Bitvault.Avalonia.AddVaultContentCommandHeaderView"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="using:Bitvault"
|
||||
x:DataType="vm:AddVaultContentHeaderViewModel">
|
||||
x:DataType="vm:AddVaultContentCommandHeaderViewModel">
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<x:Double x:Key="ButtonWidth">40</x:Double>
|
||||
@@ -0,0 +1,8 @@
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace Bitvault.Avalonia;
|
||||
|
||||
public partial class AddVaultContentCommandHeaderView : UserControl
|
||||
{
|
||||
public AddVaultContentCommandHeaderView() => InitializeComponent();
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace Bitvault.Avalonia
|
||||
{
|
||||
public partial class AddVaultContentHeaderView : UserControl
|
||||
{
|
||||
public AddVaultContentHeaderView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,44 +6,10 @@
|
||||
x:DataType="vm:AddVaultContentViewModel">
|
||||
<Interaction.Behaviors>
|
||||
<EventTriggerBehavior EventName="Loaded">
|
||||
<NavigateAction Context="{Binding Named, StringFormat='{}{0}:ContentHeader'}" Route="AddVaultContentHeader" />
|
||||
<NavigateAction Context="{Binding Named, StringFormat='{}{0}:ContentHeader'}" Route="AddVaultContentCommandHeader" />
|
||||
</EventTriggerBehavior>
|
||||
</Interaction.Behaviors>
|
||||
<Grid>
|
||||
<Grid.Styles>
|
||||
<Style Selector="Border">
|
||||
<Setter Property="BorderThickness" Value="1" />
|
||||
<Setter Property="BorderBrush" Value="DarkGray" />
|
||||
<Setter Property="Margin" Value="3" />
|
||||
<Setter Property="Background" Value="LightGray" />
|
||||
<Setter Property="Height" Value="60" />
|
||||
</Style>
|
||||
<Style Selector="Border.Header">
|
||||
<Setter Property="ResponsiveGrid.ExtraSmall" Value="12" />
|
||||
</Style>
|
||||
<Style Selector="Border.Section1">
|
||||
<Setter Property="ResponsiveGrid.ExtraSmall" Value="6" />
|
||||
<Setter Property="ResponsiveGrid.Small" Value="3" />
|
||||
<Setter Property="ResponsiveGrid.Medium" Value="2" />
|
||||
</Style>
|
||||
<Style Selector="Border.Section2">
|
||||
<Setter Property="ResponsiveGrid.ExtraSmall" Value="12" />
|
||||
<Setter Property="ResponsiveGrid.Small" Value="6" />
|
||||
<Setter Property="ResponsiveGrid.Medium" Value="2" />
|
||||
</Style>
|
||||
<Style Selector="Border.Footer">
|
||||
<Setter Property="ResponsiveGrid.ExtraSmall" Value="12" />
|
||||
</Style>
|
||||
</Grid.Styles>
|
||||
<ResponsiveGrid>
|
||||
<Border Classes="Header" />
|
||||
<Border Classes="Section1" />
|
||||
<Border Classes="Section1" />
|
||||
<Border Classes="Section1" />
|
||||
<Border Classes="Section1" />
|
||||
<Border Classes="Section2" />
|
||||
<Border Classes="Section2" />
|
||||
<Border Classes="Footer" />
|
||||
</ResponsiveGrid>
|
||||
</Grid>
|
||||
<ScrollViewer Padding="12,12,12,0">
|
||||
<ItemsControl ItemTemplate="{ReflectionBinding Template}" ItemsSource="{Binding}" />
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
|
||||
@@ -8,6 +8,7 @@ using Toolkit.Avalonia;
|
||||
using Toolkit.Foundation;
|
||||
using Microsoft.Extensions.DependencyInjection.Extensions;
|
||||
using HotAvalonia;
|
||||
using Bitvault.Data;
|
||||
|
||||
namespace Bitvault.Avalonia;
|
||||
|
||||
@@ -80,10 +81,12 @@ public partial class App : Application
|
||||
services.AddTemplate<VaultContentViewModel, VaultContentView>("VaultContent");
|
||||
|
||||
services.AddTemplate<AddVaultContentViewModel, AddVaultContentView>("AddVaultContent");
|
||||
services.AddTemplate<AddVaultContentHeaderViewModel, AddVaultContentHeaderView>("AddVaultContentHeader");
|
||||
services.AddTemplate<AddVaultContentCommandHeaderViewModel, AddVaultContentCommandHeaderView>("AddVaultContentCommandHeader");
|
||||
|
||||
services.AddTemplate<ConfirmVaultContentActionViewModel, ConfirmVaultContentActionView>();
|
||||
services.AddTemplate<DismissVaultContentActionViewModel, DismissVaultContentActionView>();
|
||||
|
||||
services.AddTemplate<VaultContentHeaderViewModel, VaultContentHeaderView>();
|
||||
});
|
||||
})!);
|
||||
|
||||
|
||||
@@ -43,6 +43,12 @@
|
||||
<Compile Update="AddVaultContentActionView.axaml.cs">
|
||||
<DependentUpon>AddVaultContentActionView.axaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="AddVaultContentCommandHeaderView.axaml.cs">
|
||||
<DependentUpon>AddVaultContentCommandHeaderView.axaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="VaultContentHeaderView.axaml.cs">
|
||||
<DependentUpon>VaultContentHeaderView.axaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="OpenView.axaml.cs">
|
||||
<DependentUpon>OpenView.axaml</DependentUpon>
|
||||
</Compile>
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
<UserControl
|
||||
x:Class="Bitvault.Avalonia.VaultContentHeaderView"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:vm="using:Bitvault"
|
||||
x:DataType="vm:VaultContentHeaderViewModel">
|
||||
<StackPanel Grid.Column="1" Spacing="18">
|
||||
<PersonPicture
|
||||
Width="96"
|
||||
Height="96"
|
||||
DisplayName="{Binding Value}" />
|
||||
<TextBox
|
||||
MaxWidth="360"
|
||||
Text="{Binding Value}"
|
||||
Watermark="Enter name" />
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,8 @@
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace Bitvault.Avalonia;
|
||||
|
||||
public partial class VaultContentHeaderView : UserControl
|
||||
{
|
||||
public VaultContentHeaderView() => InitializeComponent();
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.0-preview.3.24172.4" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.0-preview.3.24172.4">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="9.0.0-preview.3.24172.4" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.0-preview.3.24172.4">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlcipher" Version="2.1.8" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Bitvault;
|
||||
namespace Bitvault.Data;
|
||||
|
||||
public record Category
|
||||
{
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Bitvault.Data;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Bitvault;
|
||||
namespace Bitvault.Data;
|
||||
|
||||
public record Content
|
||||
{
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Bitvault;
|
||||
namespace Bitvault.Data;
|
||||
|
||||
public record Document
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Bitvault;
|
||||
namespace Bitvault.Data;
|
||||
|
||||
public enum DocumentType
|
||||
{
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Bitvault;
|
||||
namespace Bitvault.Data;
|
||||
|
||||
public class Tag
|
||||
{
|
||||
@@ -1,6 +1,7 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Bitvault.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Bitvault;
|
||||
namespace Bitvault.Data;
|
||||
|
||||
public class VaultDbContext(DbContextOptions<VaultDbContext> options) :
|
||||
DbContext(options)
|
||||
@@ -17,6 +17,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Toolkit.UI.Avalonia", "Tool
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Toolkit.UI.Controls.Avalonia", "Toolkit\Toolkit.UI.Controls.Avalonia\Toolkit.UI.Controls.Avalonia.csproj", "{716E252B-B758-4134-9D34-50FC42B414C6}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bitvault.Data", "Bitvault.Data\Bitvault.Data.csproj", "{DB60A3F3-1250-4414-A861-567C79CC8CE3}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -51,6 +53,10 @@ Global
|
||||
{716E252B-B758-4134-9D34-50FC42B414C6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{716E252B-B758-4134-9D34-50FC42B414C6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{716E252B-B758-4134-9D34-50FC42B414C6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{DB60A3F3-1250-4414-A861-567C79CC8CE3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{DB60A3F3-1250-4414-A861-567C79CC8CE3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{DB60A3F3-1250-4414-A861-567C79CC8CE3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{DB60A3F3-1250-4414-A861-567C79CC8CE3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
+2
-2
@@ -2,9 +2,9 @@
|
||||
|
||||
namespace Bitvault;
|
||||
|
||||
public partial class AddVaultContentHeaderViewModel : ObservableCollectionViewModel
|
||||
public partial class AddVaultContentCommandHeaderViewModel : ObservableCollectionViewModel
|
||||
{
|
||||
public AddVaultContentHeaderViewModel(IServiceProvider provider,
|
||||
public AddVaultContentCommandHeaderViewModel(IServiceProvider provider,
|
||||
IServiceFactory factory,
|
||||
IMediator mediator,
|
||||
IPublisher publisher,
|
||||
@@ -3,14 +3,37 @@ using Toolkit.Foundation;
|
||||
|
||||
namespace Bitvault;
|
||||
|
||||
public partial class AddVaultContentViewModel(IServiceProvider provider,
|
||||
IServiceFactory factory,
|
||||
IMediator mediator,
|
||||
IPublisher publisher,
|
||||
ISubscriber subscriber,
|
||||
IDisposer disposer,
|
||||
NamedComponent named) : ObservableCollectionViewModel(provider, factory, mediator, publisher, subscriber, disposer)
|
||||
public partial class AddVaultContentViewModel :
|
||||
ObservableCollectionViewModel<IVaultContentEntryViewModel>
|
||||
{
|
||||
[ObservableProperty]
|
||||
private string named = $"{named}";
|
||||
private string named;
|
||||
|
||||
public AddVaultContentViewModel(IServiceProvider provider,
|
||||
IServiceFactory factory,
|
||||
IMediator mediator,
|
||||
IPublisher publisher,
|
||||
ISubscriber subscriber,
|
||||
IDisposer disposer,
|
||||
IContentTemplate template,
|
||||
NamedComponent named) : base(provider, factory, mediator, publisher, subscriber, disposer)
|
||||
{
|
||||
Template = template;
|
||||
Named = $"{named}";
|
||||
|
||||
Add<VaultContentHeaderViewModel>();
|
||||
}
|
||||
|
||||
public IContentTemplate Template { get; set; }
|
||||
|
||||
public Task<bool> Confirm()
|
||||
{
|
||||
VaultContentConfiguration configuration = new();
|
||||
foreach (IVaultContentEntryViewModel item in this)
|
||||
{
|
||||
item.Invoke(configuration);
|
||||
}
|
||||
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,18 +7,9 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.0-preview.3.24172.4" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.0-preview.3.24172.4">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="9.0.0-preview.3.24172.4" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.0-preview.3.24172.4">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlcipher" Version="2.1.8" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Bitvault.Data\Bitvault.Data.csproj" />
|
||||
<ProjectReference Include="..\Toolkit\Toolkit.Avalonia\Toolkit.Avalonia.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,6 @@
|
||||
using Toolkit.Foundation;
|
||||
|
||||
namespace Bitvault;
|
||||
|
||||
public interface IVaultContentEntryViewModel :
|
||||
IValueInvoker<VaultContentConfiguration>;
|
||||
@@ -1,16 +0,0 @@
|
||||
using Toolkit.Foundation;
|
||||
|
||||
namespace Bitvault;
|
||||
|
||||
public partial class IconPickerViewModel : ObservableViewModel
|
||||
{
|
||||
public IconPickerViewModel(IServiceProvider provider,
|
||||
IServiceFactory factory,
|
||||
IMediator mediator,
|
||||
IPublisher publisher,
|
||||
ISubscriber subscriber,
|
||||
IDisposer disposer) : base(provider, factory, mediator, publisher, subscriber, disposer)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace Bitvault;
|
||||
|
||||
public record VaultContentConfiguration
|
||||
{
|
||||
public string? Name { get; set; }
|
||||
}
|
||||
@@ -7,4 +7,9 @@ public partial class VaultContentHeaderViewModel(IServiceProvider provider,
|
||||
IMediator mediator,
|
||||
IPublisher publisher,
|
||||
ISubscriber subscriber,
|
||||
IDisposer disposer) : ObservableViewModel(provider, factory, mediator, publisher, subscriber, disposer);
|
||||
IDisposer disposer) : ObservableViewModel<string, string>(provider, factory, mediator, publisher, subscriber, disposer),
|
||||
IVaultContentEntryViewModel
|
||||
{
|
||||
public void Invoke(VaultContentConfiguration args) =>
|
||||
args.Name = Value;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Bitvault.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Toolkit.Foundation;
|
||||
|
||||
Reference in New Issue
Block a user