コード例 #1
0
ファイル: NostromoApp.cs プロジェクト: mcortecchia/Nostromo
        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);
            }
        }
コード例 #2
0
        public static NostromoSettings RegisterAssemblyViews(this NostromoSettings settings, Assembly assembly)
        {
            settings.AssembliesToRegisterViewsFor = (settings.AssembliesToRegisterViewsFor ?? new Assembly[] {})
                                                    .Concat(new[] { assembly })
                                                    .ToArray();

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