Пример #1
0
        private static void InitializeContainer(IQFrameworkContainer container)
        {
            mViews = null;
            container.RegisterInstance(container);
            var viewTypes = GetDerivedTypes <IPackageKitView>(false, false).ToArray();

            foreach (var view in viewTypes)
            {
                var viewInstance = Activator.CreateInstance(view) as IPackageKitView;
                if (viewInstance == null)
                {
                    continue;
                }
                container.RegisterInstance(viewInstance, view.Name, false);
                container.RegisterInstance(viewInstance.GetType(), viewInstance);
            }

            container.InjectAll();

            foreach (var view in Views)
            {
                view.Container = Container;
                view.Init(Container);
            }

            foreach (var view in Views)
            {
                container.Inject(view);
            }
        }
Пример #2
0
        private static void InitializeContainer(IQFrameworkContainer container)
        {
            container.RegisterInstance(container);
            var viewTypes = FrameworkEngine.GetDerivedTypes <ISubModule>(false, false).ToArray();

            Debug.Log($"viewTypes = {viewTypes.Length} ");
            foreach (var view in viewTypes)
            {
                var viewInstance = Activator.CreateInstance(view) as ISubModule;
                if (viewInstance == null)
                {
                    continue;
                }
                container.RegisterInstance(viewInstance, view.Name, false);
                container.RegisterInstance(viewInstance.GetType(), viewInstance);
            }
            container.InjectAll();

            _subModules = Container.ResolveAll <ISubModule>().ToList();
            Debug.Log($"_subModules = {_subModules.Count} ");

            foreach (var view in _subModules)
            {
                view.Init(Container);
            }

//            foreach (var view in _subModules)
//            {
//                container.Inject(view);
//            }
        }
Пример #3
0
        private static void InitializeContainer(IQFrameworkContainer container)
        {
            container.RegisterInstance(container);

            container.InjectAll();

            SignalEvent <ISystemResetEvents>(_ => _.SystemRestarted());
        }
Пример #4
0
        private static void InitializeContainer(IQFrameworkContainer container)
        {
            _plugins = null;
            container.RegisterInstance <IQFrameworkContainer>(container);
            var pluginTypes = GetDerivedTypes <ICorePlugin>(false, false).ToArray();

            // Load all plugins
            foreach (var diagramPlugin in pluginTypes)
            {
                if (pluginTypes.Any(p => p.BaseType == diagramPlugin))
                {
                    continue;
                }
                var pluginInstance = Activator.CreateInstance((Type)diagramPlugin) as ICorePlugin;
                if (pluginInstance == null)
                {
                    continue;
                }
                container.RegisterInstance(pluginInstance, diagramPlugin.Name, false);
                container.RegisterInstance(pluginInstance.GetType(), pluginInstance);
                if (pluginInstance.Enabled)
                {
                    foreach (var item in diagramPlugin.GetInterfaces())
                    {
                        ListenFor(item, pluginInstance);
                    }
                }
            }

            container.InjectAll();

            foreach (var diagramPlugin in Plugins.OrderBy(p => p.LoadPriority).Where(p => !p.Ignore))
            {
                if (diagramPlugin.Enabled)
                {
                    var start = DateTime.Now;
                    diagramPlugin.Container = Container;
                    diagramPlugin.Initialize(Container);
                }
            }

            foreach (var diagramPlugin in Plugins.OrderBy(p => p.LoadPriority).Where(p => !p.Ignore))
            {
                if (diagramPlugin.Enabled)
                {
                    var start = DateTime.Now;
                    container.Inject(diagramPlugin);
                    diagramPlugin.Loaded(Container);
                    diagramPlugin.LoadTime = DateTime.Now.Subtract(start);
                }
            }
            SignalEvent <ISystemResetEvents>(_ => _.SystemRestarted());
        }
        private static void InitializeContainer(IQFrameworkContainer container)
        {
            mPlugins = null;
            container.RegisterInstance(container);
            var pluginTypes = GetDerivedTypes <QFramework.IPackageKitView>(false, false).ToArray();

            foreach (var diagramPlugin in pluginTypes)
            {
                var pluginInstance = Activator.CreateInstance((Type)diagramPlugin) as QFramework.IPackageKitView;
                if (pluginInstance == null)
                {
                    continue;
                }
                container.RegisterInstance(pluginInstance, diagramPlugin.Name, false);
                container.RegisterInstance(pluginInstance.GetType(), pluginInstance);
                if (pluginInstance.Enabled)
                {
                    foreach (var item in diagramPlugin.GetInterfaces())
                    {
                        ListenFor(item, pluginInstance);
                    }
                }
            }

            container.InjectAll();

            foreach (var diagramPlugin in Plugins.Where(p => !p.Ignore))
            {
                if (diagramPlugin.Enabled)
                {
                    var start = DateTime.Now;
                    diagramPlugin.Container = Container;
                    diagramPlugin.Init(Container);
                }
            }

            foreach (var diagramPlugin in Plugins.Where(p => !p.Ignore))
            {
                if (diagramPlugin.Enabled)
                {
                    var start = DateTime.Now;
                    container.Inject(diagramPlugin);
//					diagramPlugin.Loaded(Container);
//					diagramPlugin.LoadTime = DateTime.Now.Subtract(start);
                }
            }

            SignalEvent <ISystemResetEvents>(_ => _.SystemRestarted());
        }
Пример #6
0
        private static void InitializeContainer(IQFrameworkContainer container)
        {
            container.RegisterInstance(container);

            container.InjectAll();
        }