Esempio n. 1
0
        //--------------------------------------------------
        //--Module Initialization and Configuration
        //--------------------------------------------------

        // Before services are registered by modules, a two phase initialization is completed.
        // First all modules have the Initialize() method called.  The Initialize() method is
        // where plugins should cache information that can be accessed my other modules.
        // After all modules are initialized, each module has The Configure() method called.
        // Code contained within a module's Configure() method can reference information
        // initialized by a dependent module.
        private void ConfigurePlugins()
        {
            CorePlugins.ForEach(ConfigureModules);
            AppPlugins.ForEach(ConfigureModules);

            ConfigureModules(HostPlugin);
        }
Esempio n. 2
0
        protected virtual void InitAppPlugins()
        {
            var types = ShReflectionUtils.GetTypesFromAssemblies <IPlugin>(AppPluginsAssemblies);

            foreach (var type in types.OrderByDescending(a => a.Name))
            {
                try
                {
                    if (!AppDataServices.Any(t => t.GetType() == type))
                    {
                        var instance = Activator.CreateInstance(type) as IPlugin;

                        instance.Init();

                        AppPlugins.Add(instance);
                    }
                }

                catch (System.Exception e)
                {
                    // TODO
                    throw;
                }
            }
        }
Esempio n. 3
0
        private IEnumerable <Type> FilteredTypesByPluginType(IPlugin plugin)
        {
            // Core plug-in can access types from all other plug-in types.
            if (plugin.PluginType == PluginTypes.CorePlugin)
            {
                return(AllPlugins.SelectMany(p => p.Types));
            }

            // Application centric plug-in can only access types contained in
            // other application plugs.
            return(AppPlugins.SelectMany(p => p.Types));
        }