Exemple #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);
            }
        }
Exemple #2
0
        public static NostromoSettings RegisterAssemblyViews(this NostromoSettings settings, Assembly assembly)
        {
            settings.AssembliesToRegisterViewsFor = (settings.AssembliesToRegisterViewsFor ?? new Assembly[] {})
                                                    .Concat(new[] { assembly })
                                                    .ToArray();

            return(settings);
        }
Exemple #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));
        }
Exemple #4
0
 public static NostromoSettings RegisterDependenciesInAssemblyOf <TTypeForAssembly>(this NostromoSettings settings)
 {
     return(settings.RegisterAssemblyDependencies(typeof(TTypeForAssembly).GetTypeInfo().Assembly));
 }
Exemple #5
0
 public static void Init(this NostromoSettings config)
 {
     NostromoApp.Initialize(config);
 }
Exemple #6
0
 public static NostromoSettings UsePlatformViewActivator(this NostromoSettings settings, IPlatformViewActivator activator)
 {
     settings.ViewActivator = activator;
     return(settings);
 }
Exemple #7
0
 public static NostromoSettings UseAutofacContainer(this NostromoSettings settings)
 {
     settings.IOCImplementation = new AutofacContainerImplementation();
     return(settings);
 }