예제 #1
0
        // Note, the 'isStatic' flag is only temporary while StaticPlugins are being
        // deprecated, after that this distinction is not necessary anymore and
        // can be removed.
        public PluginObjects CreatePluginObjects(IInjector injector, bool isStatic)
        {
            object pluginInstance = null;

            if (!isStatic)
            {
                if (!injector.TryCreate(pluginType, out pluginInstance))
                {
                    return(null);                    // TODO
                }
                injector.FillProperties(pluginInstance);
            }
            if (!injector.TryGet <CommandManager>(out var commandManager))
            {
                return(null);                //TODO
            }
            var pluginObjs = new PluginObjects
            {
                Plugin         = (ITabPlugin)pluginInstance,
                Bag            = new PluginCommandBag(pluginInstance, pluginType),
                CommandManager = commandManager,
            };

            pluginObjs.CommandManager.RegisterCollection(pluginObjs.Bag);
            return(pluginObjs);
        }