mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-11 19:36:28 +00:00
Core - Refactor service registration
This commit is contained in:
1 parent
a1086df41a
commit
f2ef657d00
18 files changed
+234
-231
No files matched your search
@@ -33,7 +33,7 @@ public class App : Application
|
||||
Environment.Exit(1);
|
||||
}
|
||||
|
||||
_container = ArtemisBootstrapper.Bootstrap(this, new WindowsModule());
|
||||
_container = ArtemisBootstrapper.Bootstrap(this, c => c.RegisterProviders());
|
||||
Program.CreateLogger(_container);
|
||||
RxApp.MainThreadScheduler = AvaloniaScheduler.Instance;
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
using Artemis.Core.Providers;
|
||||
using Artemis.Core.Services;
|
||||
using Artemis.UI.Shared.Providers;
|
||||
using Artemis.UI.Windows.Providers;
|
||||
using Artemis.UI.Windows.Providers.Input;
|
||||
using DryIoc;
|
||||
|
||||
namespace Artemis.UI.Windows.DryIoc;
|
||||
|
||||
/// <summary>
|
||||
/// Provides an extension method to register services onto a DryIoc <see cref="IContainer"/>.
|
||||
/// </summary>
|
||||
public static class UIContainerExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Registers providers into the container.
|
||||
/// </summary>
|
||||
/// <param name="container">The builder building the current container</param>
|
||||
public static void RegisterProviders(this IContainer container)
|
||||
{
|
||||
container.Register<ICursorProvider, CursorProvider>(Reuse.Singleton);
|
||||
container.Register<IGraphicsContextProvider, GraphicsContextProvider>(Reuse.Singleton);
|
||||
container.Register<IUpdateProvider, UpdateProvider>(Reuse.Singleton);
|
||||
container.Register<IAutoRunProvider, AutoRunProvider>();
|
||||
container.Register<InputProvider, WindowsInputProvider>(serviceKey: WindowsInputProvider.Id);
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
using Artemis.Core.DryIoc;
|
||||
using Artemis.Core.Providers;
|
||||
using Artemis.Core.Services;
|
||||
using Artemis.UI.Shared.Providers;
|
||||
using Artemis.UI.Windows.Providers;
|
||||
using Artemis.UI.Windows.Providers.Input;
|
||||
using DryIoc;
|
||||
|
||||
namespace Artemis.UI.Windows.DryIoc;
|
||||
|
||||
public class WindowsModule : IModule
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void Load(IRegistrator builder)
|
||||
{
|
||||
builder.Register<ICursorProvider, CursorProvider>(Reuse.Singleton);
|
||||
builder.Register<IGraphicsContextProvider, GraphicsContextProvider>(Reuse.Singleton);
|
||||
builder.Register<IUpdateProvider, UpdateProvider>(Reuse.Singleton);
|
||||
builder.Register<IAutoRunProvider, AutoRunProvider>();
|
||||
builder.Register<InputProvider, WindowsInputProvider>(serviceKey: WindowsInputProvider.Id);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user