Make region selector shower instead of whole screen )
This commit is contained in:
@@ -4,96 +4,76 @@ using System.Linq.Expressions;
|
||||
using System.Reflection;
|
||||
using LightInject;
|
||||
|
||||
namespace EveOPreview
|
||||
{
|
||||
// Adapts LighInject to the generic IoC interface
|
||||
sealed class LightInjectContainer : IIocContainer
|
||||
{
|
||||
private readonly ServiceContainer _container;
|
||||
namespace EveOPreview {
|
||||
// Adapts LighInject to the generic IoC interface
|
||||
sealed class LightInjectContainer : IIocContainer {
|
||||
private readonly ServiceContainer _container;
|
||||
|
||||
public LightInjectContainer()
|
||||
{
|
||||
this._container = new ServiceContainer(ContainerOptions.Default);
|
||||
}
|
||||
public LightInjectContainer() {
|
||||
this._container = new ServiceContainer(ContainerOptions.Default);
|
||||
}
|
||||
|
||||
public bool IsRegistered<TService>()
|
||||
{
|
||||
return this._container.CanGetInstance(typeof(TService), "");
|
||||
}
|
||||
public bool IsRegistered<TService>() {
|
||||
return this._container.CanGetInstance(typeof(TService), "");
|
||||
}
|
||||
|
||||
public void Register(Type serviceType, Assembly container)
|
||||
{
|
||||
if (!serviceType.IsInterface)
|
||||
{
|
||||
this._container.Register(serviceType, new PerContainerLifetime());
|
||||
return;
|
||||
}
|
||||
public void Register(Type serviceType, Assembly container) {
|
||||
if (!serviceType.IsInterface) {
|
||||
this._container.Register(serviceType, new PerContainerLifetime());
|
||||
return;
|
||||
}
|
||||
|
||||
if (serviceType.IsInterface && serviceType.IsGenericType)
|
||||
{
|
||||
this._container.RegisterAssembly(container, (st, it) => st.IsConstructedGenericType && st.GetGenericTypeDefinition() == serviceType);
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (TypeInfo implementationType in container.DefinedTypes)
|
||||
{
|
||||
if (!implementationType.IsClass || implementationType.IsAbstract)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (serviceType.IsInterface && serviceType.IsGenericType) {
|
||||
this._container.RegisterAssembly(
|
||||
container, (st, it) => st.IsConstructedGenericType && st.GetGenericTypeDefinition() == serviceType);
|
||||
} else {
|
||||
foreach (TypeInfo implementationType in container.DefinedTypes) {
|
||||
if (!implementationType.IsClass || implementationType.IsAbstract) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (serviceType.IsAssignableFrom(implementationType))
|
||||
{
|
||||
this._container.Register(serviceType, implementationType, new PerContainerLifetime());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (serviceType.IsAssignableFrom(implementationType)) {
|
||||
this._container.Register(serviceType, implementationType, new PerContainerLifetime());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Register<TService>()
|
||||
{
|
||||
this.Register(typeof(TService), typeof(TService).Assembly);
|
||||
}
|
||||
public void Register<TService>() {
|
||||
this.Register(typeof(TService), typeof(TService).Assembly);
|
||||
}
|
||||
|
||||
public void Register<TService, TImplementation>()
|
||||
where TImplementation : TService
|
||||
{
|
||||
this._container.Register<TService, TImplementation>();
|
||||
}
|
||||
public void Register<TService, TImplementation>()
|
||||
where TImplementation : TService {
|
||||
this._container.Register<TService, TImplementation>();
|
||||
}
|
||||
|
||||
public void Register<TService>(Expression<Func<TService>> factory)
|
||||
{
|
||||
this._container.Register(f => factory);
|
||||
}
|
||||
public void Register<TService>(Expression<Func<TService>> factory) {
|
||||
this._container.Register(f => factory);
|
||||
}
|
||||
|
||||
public void Register<TService, TArgument>(Expression<Func<TArgument, TService>> factory)
|
||||
{
|
||||
this._container.Register(f => factory);
|
||||
}
|
||||
public void Register<TService, TArgument>(Expression<Func<TArgument, TService>> factory) {
|
||||
this._container.Register(f => factory);
|
||||
}
|
||||
|
||||
public void RegisterInstance<TService>(TService instance)
|
||||
{
|
||||
this._container.RegisterInstance(instance);
|
||||
}
|
||||
public void RegisterInstance<TService>(TService instance) {
|
||||
this._container.RegisterInstance(instance);
|
||||
}
|
||||
|
||||
public TService Resolve<TService>()
|
||||
{
|
||||
return this._container.GetInstance<TService>();
|
||||
}
|
||||
public TService Resolve<TService>() {
|
||||
return this._container.GetInstance<TService>();
|
||||
}
|
||||
|
||||
public IEnumerable<TService> ResolveAll<TService>()
|
||||
{
|
||||
return this._container.GetAllInstances<TService>();
|
||||
}
|
||||
public IEnumerable<TService> ResolveAll<TService>() {
|
||||
return this._container.GetAllInstances<TService>();
|
||||
}
|
||||
|
||||
public object Resolve(Type serviceType)
|
||||
{
|
||||
return this._container.GetInstance(serviceType);
|
||||
}
|
||||
public object Resolve(Type serviceType) {
|
||||
return this._container.GetInstance(serviceType);
|
||||
}
|
||||
|
||||
public IEnumerable<object> ResolveAll(Type serviceType)
|
||||
{
|
||||
return this._container.GetAllInstances(serviceType);
|
||||
}
|
||||
}
|
||||
public IEnumerable<object> ResolveAll(Type serviceType) {
|
||||
return this._container.GetAllInstances(serviceType);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user