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.Services.Updating; 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 ContainerExtensions { /// /// Registers UI services into the container. /// /// The builder building the current container public static void RegisterUI(this IContainer container) { Assembly[] thisAssembly = {typeof(ContainerExtensions).Assembly}; container.RegisterInstance(new AssetLoader(), IfAlreadyRegistered.Throw); container.Register(Reuse.Singleton); container.RegisterMany(thisAssembly, type => type.IsAssignableTo()); 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.Register(); container.RegisterMany(thisAssembly, type => type.IsAssignableTo(), Reuse.Singleton); } }