public PluginEventHandler GetEventHandler(IPagePlugin pluginInstance)
        {
            PagePluginHandler pageHandler = this.commandHandler.pageHandler;

            if (pageHandler.pluginAttribute.Reusable)
            {
                IPagePlugin target = pageHandler.GetPluginInstance();
                return(this.CreateEventHandler(target, this.methodInfo));
            }
            return(this.CreateEventHandler(pluginInstance, this.methodInfo));
        }
示例#2
0
        public static IPagePlugin GetPlugin(Page page)
        {
            string pagePluginKey = GetPagePluginKey(page);

            if (pluginHandlers.ContainsKey(pagePluginKey))
            {
                PagePluginHandler handler = pluginHandlers[pagePluginKey];
                if (handler.pluginAttribute.Reusable)
                {
                    return(handler.GetPluginInstance());
                }
                IPagePlugin plugin = Activator.CreateInstance(handler.pluginType) as IPagePlugin;
                if (plugin == null)
                {
                    throw new ApplicationExceptionFormat("创建页面{0}插件{1}的实例失败", new object[] { handler.pluginAttribute.PageName, handler.pluginType });
                }
                return(plugin);
            }
            return(null);
        }