Ejemplo n.º 1
0
        public static void Initialize(NostromoSettings config)
        {
            Container.iocImplementation = config.IOCImplementation;
            if (Container.iocImplementation == null)
            {
                throw new Exception("the IOCImplementation isn't specified");
            }

            Container = (new Container());
            if (config.ViewActivator != null)
            {
                Container.Register <IPlatformViewActivator> (config.ViewActivator);
            }

            foreach (var assembly in config.AssembliesToRegisterDependenciesFor ?? new System.Reflection.Assembly[] {})
            {
                Container.RegisterAssemblyDependencies(assembly);
            }

            foreach (var assembly in config.AssembliesToRegisterViewsFor ?? new System.Reflection.Assembly[] {})
            {
                if (config.ViewActivator == null)
                {
                    throw new Exception("the IPlatformViewActivator isn't specified");
                }

                config.ViewActivator.RegisterAssemblyViews(assembly);
            }
        }
Ejemplo n.º 2
0
        public static NostromoSettings RegisterAssemblyViews(this NostromoSettings settings, Assembly assembly)
        {
            settings.AssembliesToRegisterViewsFor = (settings.AssembliesToRegisterViewsFor ?? new Assembly[] {})
                                                    .Concat(new[] { assembly })
                                                    .ToArray();

            return(settings);
        }
Ejemplo n.º 3
0
        public static NostromoSettings UseGenericPlatformViewActivator(this NostromoSettings settings, Action <IPlatformViewActivator> withActivator = null)
        {
            var activator = new GenericPlatformViewActivator();

            if (withActivator != null)
            {
                withActivator(activator);
            }
            return(settings.UsePlatformViewActivator(activator));
        }
Ejemplo n.º 4
0
 public static NostromoSettings RegisterDependenciesInAssemblyOf <TTypeForAssembly>(this NostromoSettings settings)
 {
     return(settings.RegisterAssemblyDependencies(typeof(TTypeForAssembly).GetTypeInfo().Assembly));
 }
Ejemplo n.º 5
0
 public static void Init(this NostromoSettings config)
 {
     NostromoApp.Initialize(config);
 }
Ejemplo n.º 6
0
 public static NostromoSettings UsePlatformViewActivator(this NostromoSettings settings, IPlatformViewActivator activator)
 {
     settings.ViewActivator = activator;
     return(settings);
 }
Ejemplo n.º 7
0
 public static NostromoSettings UseAutofacContainer(this NostromoSettings settings)
 {
     settings.IOCImplementation = new AutofacContainerImplementation();
     return(settings);
 }