using System.Reflection;
using Artemis.UI.DryIoc.Factories;
using Artemis.UI.DryIoc.InstanceProviders;
using Artemis.UI.Screens;
using Artemis.UI.Screens.VisualScripting;
using Artemis.UI.Services.Interfaces;
using Artemis.UI.Shared;
using Artemis.UI.Shared.Services.NodeEditor;
using Artemis.UI.Shared.Services.ProfileEditor;
using Avalonia.Platform;
using Avalonia.Shared.PlatformSupport;
using DryIoc;
namespace Artemis.UI.DryIoc;
///
/// Provides an extension method to register services onto a DryIoc .
///
public static class UIContainerExtensions
{
///
/// Registers UI services into the container.
///
/// The builder building the current container
public static void RegisterUI(this IContainer container)
{
Assembly[] thisAssembly = {typeof(UIContainerExtensions).Assembly};
container.RegisterInstance(new AssetLoader(), IfAlreadyRegistered.Throw);
container.Register(Reuse.Singleton);
container.RegisterMany(thisAssembly, type => type.IsAssignableTo());
container.RegisterMany(thisAssembly, type => type.IsAssignableTo(), ifAlreadyRegistered: IfAlreadyRegistered.Replace);
container.RegisterMany(thisAssembly, type => type.IsAssignableTo() && type.IsInterface);
container.RegisterMany(thisAssembly, type => type.IsAssignableTo() && type != typeof(PropertyVmFactory));
container.Register(Reuse.Singleton);
container.Register(Reuse.Singleton);
container.RegisterMany(thisAssembly, type => type.IsAssignableTo(), Reuse.Singleton);
}
}