Project refactor

This commit is contained in:
2022-01-07 18:46:56 +01:00
parent 9956fb4c26
commit a0c28eb749
10 changed files with 199 additions and 13 deletions

View File

@@ -0,0 +1,24 @@
using FileTime.App.Core.Clipboard;
using FileTime.Core.Command;
using FileTime.Core.Providers;
using FileTime.Core.StateManagement;
using FileTime.Providers.Local;
using Microsoft.Extensions.DependencyInjection;
namespace FileTime.App.Core
{
public static class DependencyInjection
{
public static IServiceCollection RegisterDefaultServices(IServiceCollection? serviceCollection = null)
{
serviceCollection ??= new ServiceCollection();
return serviceCollection
.AddSingleton<IClipboard, Clipboard.Clipboard>()
.AddSingleton<LocalContentProvider>()
.AddSingleton<IContentProvider, LocalContentProvider>(sp => sp.GetService<LocalContentProvider>() ?? throw new Exception($"No {nameof(LocalContentProvider)} instance found"))
.AddSingleton<ElementCreationStates>()
.AddSingleton<CommandExecutor>();
}
}
}