Amend reading config
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
using Toolkit.Foundation;
|
||||
|
||||
namespace Bitvault;
|
||||
|
||||
public class AllNavigationViewModel(IServiceProvider serviceProvider,
|
||||
IServiceFactory serviceFactory,
|
||||
IPublisher publisher,
|
||||
ISubscriber subscriber,
|
||||
IDisposer disposer) :
|
||||
ObservableViewModel(serviceProvider, serviceFactory, publisher, subscriber, disposer),
|
||||
IMainNavigationViewModel;
|
||||
@@ -0,0 +1,11 @@
|
||||
using Toolkit.Foundation;
|
||||
|
||||
namespace Bitvault;
|
||||
|
||||
public class ArchiveNavigationViewModel(IServiceProvider serviceProvider,
|
||||
IServiceFactory serviceFactory,
|
||||
IPublisher publisher,
|
||||
ISubscriber subscriber,
|
||||
IDisposer disposer) :
|
||||
ObservableViewModel(serviceProvider, serviceFactory, publisher, subscriber, disposer),
|
||||
IMainNavigationViewModel;
|
||||
@@ -1,9 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.0-preview.3.24172.9" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Toolkit\Toolkit.Avalonia\Toolkit.Avalonia.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,11 @@
|
||||
using Toolkit.Foundation;
|
||||
|
||||
namespace Bitvault;
|
||||
|
||||
public class CategoriesNavigationViewModel(IServiceProvider serviceProvider,
|
||||
IServiceFactory serviceFactory,
|
||||
IPublisher publisher,
|
||||
ISubscriber subscriber,
|
||||
IDisposer disposer) :
|
||||
ObservableViewModel(serviceProvider, serviceFactory, publisher, subscriber, disposer),
|
||||
IMainNavigationViewModel;
|
||||
@@ -0,0 +1,4 @@
|
||||
namespace Bitvault;
|
||||
|
||||
public interface IMainNavigationViewModel;
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
using Toolkit.Foundation;
|
||||
|
||||
namespace Bitvault;
|
||||
|
||||
public interface IVaultComponent : IComponent;
|
||||
@@ -0,0 +1,3 @@
|
||||
namespace Bitvault;
|
||||
|
||||
public record Locked;
|
||||
@@ -0,0 +1,10 @@
|
||||
using Toolkit.Foundation;
|
||||
|
||||
namespace Bitvault;
|
||||
|
||||
public class LockerNavigationViewModel(IServiceProvider serviceProvider,
|
||||
IServiceFactory serviceFactory,
|
||||
IPublisher publisher,
|
||||
ISubscriber subscriber,
|
||||
IDisposer disposer) :
|
||||
ObservableViewModel(serviceProvider, serviceFactory, publisher, subscriber, disposer);
|
||||
@@ -0,0 +1,10 @@
|
||||
using Toolkit.Foundation;
|
||||
|
||||
namespace Bitvault;
|
||||
|
||||
public class LockerViewModel(IServiceProvider serviceProvider,
|
||||
IServiceFactory serviceFactory,
|
||||
IPublisher publisher,
|
||||
ISubscriber subscriber,
|
||||
IDisposer disposer) :
|
||||
ObservableViewModel(serviceProvider, serviceFactory, publisher, subscriber, disposer);
|
||||
@@ -1,14 +1,10 @@
|
||||
namespace Bitvault
|
||||
{
|
||||
public class LockViewModel;
|
||||
using Toolkit.Foundation;
|
||||
|
||||
public class VaultViewModel;
|
||||
namespace Bitvault;
|
||||
|
||||
public class VaultNavigationViewModel;
|
||||
|
||||
public class AllNavigationViewModel;
|
||||
|
||||
public class FavouriteNavigationViewModel;
|
||||
|
||||
public class CategoryNavigationViewModel;
|
||||
}
|
||||
public class LockViewModel(IServiceProvider serviceProvider,
|
||||
IServiceFactory serviceFactory,
|
||||
IPublisher publisher,
|
||||
ISubscriber subscriber,
|
||||
IDisposer disposer) :
|
||||
ObservableViewModel(serviceProvider, serviceFactory, publisher, subscriber, disposer);
|
||||
@@ -0,0 +1,14 @@
|
||||
using Toolkit.Foundation;
|
||||
|
||||
namespace Bitvault;
|
||||
|
||||
public class MainViewHandler(IPublisher publisher,
|
||||
IServiceFactory factory) :
|
||||
INotificationHandler<Enumerate<IMainNavigationViewModel>>
|
||||
{
|
||||
public async Task Handle(Enumerate<IMainNavigationViewModel> args,
|
||||
CancellationToken cancellationToken = default)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using Toolkit.Foundation;
|
||||
|
||||
namespace Bitvault;
|
||||
|
||||
public partial class MainViewModel :
|
||||
ObservableCollectionViewModel<IMainNavigationViewModel>
|
||||
{
|
||||
public MainViewModel(IServiceProvider serviceProvider,
|
||||
IServiceFactory serviceFactory,
|
||||
IPublisher publisher,
|
||||
ISubscriber subscriber,
|
||||
IDisposer disposer,
|
||||
IContentTemplate template) : base(serviceProvider, serviceFactory, publisher, subscriber, disposer)
|
||||
{
|
||||
Template = template;
|
||||
Add<VaultNavigationViewModel>();
|
||||
}
|
||||
|
||||
public IContentTemplate Template { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using Toolkit.Foundation;
|
||||
|
||||
namespace Bitvault;
|
||||
|
||||
public class MainWindowViewModel(IServiceProvider serviceProvider,
|
||||
IServiceFactory serviceFactory,
|
||||
IPublisher publisher,
|
||||
ISubscriber subscriber,
|
||||
IDisposer disposer) :
|
||||
ObservableViewModel(serviceProvider, serviceFactory, publisher, subscriber, disposer);
|
||||
@@ -0,0 +1,11 @@
|
||||
using Toolkit.Foundation;
|
||||
|
||||
namespace Bitvault;
|
||||
|
||||
public class StarredNavigationViewModel(IServiceProvider serviceProvider,
|
||||
IServiceFactory serviceFactory,
|
||||
IPublisher publisher,
|
||||
ISubscriber subscriber,
|
||||
IDisposer disposer) :
|
||||
ObservableViewModel(serviceProvider, serviceFactory, publisher, subscriber, disposer),
|
||||
IMainNavigationViewModel;
|
||||
@@ -0,0 +1,3 @@
|
||||
namespace Bitvault;
|
||||
|
||||
public class SystemIdleTimer;
|
||||
@@ -0,0 +1,3 @@
|
||||
namespace Bitvault;
|
||||
|
||||
public record Unlocked;
|
||||
@@ -0,0 +1,50 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Toolkit.Foundation;
|
||||
|
||||
namespace Bitvault;
|
||||
|
||||
public class VaultComponentsCollectionInitializer(IServiceProvider provider,
|
||||
IProxyServiceCollection<IComponentBuilder> proxy,
|
||||
VaultConfigurationCollection configurations) : IInitializer
|
||||
{
|
||||
public Task Initialize()
|
||||
{
|
||||
//for (int index = 0; index < configurations.Count; index++)
|
||||
//{
|
||||
// VaultConfiguration configuration = configurations[index];
|
||||
// if (provider.GetRequiredService<IVaultComponent>() is IVaultComponent component)
|
||||
// {
|
||||
// IComponentBuilder builder = component.Create();
|
||||
// builder.AddServices(services =>
|
||||
// {
|
||||
// services.AddTransient(_ =>
|
||||
// provider.GetRequiredService<IProxyService<IPublisher>>());
|
||||
|
||||
// services.AddTransient(_ =>
|
||||
// provider.GetRequiredService<IProxyService<IComponentHostCollection>>());
|
||||
|
||||
// services.AddScoped(_ =>
|
||||
// provider.GetRequiredService<INavigationContextCollection>());
|
||||
|
||||
// services.AddScoped(_ =>
|
||||
// provider.GetRequiredService<INavigationContextProvider>());
|
||||
|
||||
// services.AddScoped(_ =>
|
||||
// provider.GetRequiredService<IComponentScopeCollection>());
|
||||
|
||||
// services.AddTransient(_ =>
|
||||
// provider.GetRequiredService<IComponentScopeProvider>());
|
||||
|
||||
// services.AddRange(proxy.Services);
|
||||
// });
|
||||
|
||||
// builder.AddConfiguration<VaultConfiguration>(name: $"{nameof(VaultConfigurationCollection)}:{configuration.Name}");
|
||||
|
||||
// IComponentHost host = builder.Build();
|
||||
// host.StartAsync();
|
||||
// }
|
||||
//}
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using System.Text.Json.Serialization;
|
||||
using Toolkit.Foundation;
|
||||
|
||||
namespace Bitvault;
|
||||
|
||||
public record VaultConfiguration : ComponentConfiguration
|
||||
{
|
||||
public string? Name { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
using System.Dynamic;
|
||||
|
||||
namespace Bitvault;
|
||||
|
||||
public class VaultConfigurationCollection : DynamicObject;
|
||||
@@ -0,0 +1,25 @@
|
||||
using Toolkit.Foundation;
|
||||
|
||||
namespace Bitvault;
|
||||
|
||||
public partial class VaultNavigationViewModel :
|
||||
ObservableCollectionViewModel<IMainNavigationViewModel>,
|
||||
IMainNavigationViewModel
|
||||
{
|
||||
public VaultNavigationViewModel(IServiceProvider serviceProvider,
|
||||
IServiceFactory serviceFactory,
|
||||
IPublisher publisher,
|
||||
ISubscriber subscriber,
|
||||
IDisposer disposer,
|
||||
IContentTemplate template) : base(serviceProvider, serviceFactory, publisher, subscriber, disposer)
|
||||
{
|
||||
Template = template;
|
||||
|
||||
Add<AllNavigationViewModel>();
|
||||
Add<StarredNavigationViewModel>();
|
||||
Add<ArchiveNavigationViewModel>();
|
||||
Add<CategoriesNavigationViewModel>();
|
||||
}
|
||||
|
||||
public IContentTemplate Template { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using Toolkit.Foundation;
|
||||
|
||||
namespace Bitvault;
|
||||
|
||||
public class VaultViewModel(IServiceProvider serviceProvider,
|
||||
IServiceFactory serviceFactory,
|
||||
IPublisher publisher,
|
||||
ISubscriber subscriber,
|
||||
IDisposer disposer) :
|
||||
ObservableViewModel(serviceProvider, serviceFactory, publisher, subscriber, disposer);
|
||||
Reference in New Issue
Block a user