mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
42 lines
1.4 KiB
C#
42 lines
1.4 KiB
C#
using System;
|
|
using Artemis.UI.Shared.Ninject.Factories;
|
|
using Artemis.UI.Shared.Services.Interfaces;
|
|
using MaterialDesignThemes.Wpf;
|
|
using Ninject.Extensions.Conventions;
|
|
using Ninject.Modules;
|
|
|
|
namespace Artemis.UI.Shared.Ninject
|
|
{
|
|
// ReSharper disable once InconsistentNaming
|
|
public class SharedUIModule : NinjectModule
|
|
{
|
|
public override void Load()
|
|
{
|
|
if (Kernel == null)
|
|
throw new ArgumentNullException("Kernel shouldn't be null here.");
|
|
|
|
// Bind UI factories
|
|
Kernel.Bind(x =>
|
|
{
|
|
x.FromAssemblyContaining<IVmFactory>()
|
|
.IncludingNonPublicTypes()
|
|
.SelectAllInterfaces()
|
|
.InheritedFrom<IVmFactory>()
|
|
.BindToFactory();
|
|
});
|
|
|
|
// Bind all shared UI services as singletons
|
|
Kernel.Bind(x =>
|
|
{
|
|
x.FromAssemblyContaining<IArtemisSharedUIService>()
|
|
.IncludingNonPublicTypes()
|
|
.SelectAllClasses()
|
|
.InheritedFrom<IArtemisSharedUIService>()
|
|
.BindAllInterfaces()
|
|
.Configure(c => c.InSingletonScope());
|
|
});
|
|
|
|
Kernel.Bind<ISnackbarMessageQueue>().ToConstant(new SnackbarMessageQueue(TimeSpan.FromSeconds(5))).InSingletonScope();
|
|
}
|
|
}
|
|
} |