public void RegisterRoute(Route route, IMvcPlugin plugin)
 {
     m_registeredRoutes.Add(new PluginRoute()
     {
         Plugin = plugin, Route = route
     });
 }
 protected virtual void RenderWidget(HtmlHelper html, IMvcPlugin plugin, Widget widget, object widgetOptions)
 {
     if (ShouldIncludeResource(ResourceTypes.Widget, plugin))
     {
         PreRenderWidget(html, plugin, widget);
         html.RenderAction(widget.Action, widget.Controller, widgetOptions);
         PostRenderWidget(html, plugin, widget);
     }
 }
        public Route RegisterRoute(IMvcPlugin plugin, string name, string url, object defaults, object constraints, string[] namespaces)
        {
            Route r = m_routes.MapRoute(name, url, defaults, constraints, namespaces);

            m_routes.Remove(r);
            m_registeredRoutes.Add(new PluginRoute()
            {
                Plugin = plugin, Route = r
            });
            return(r);
        }
        protected virtual bool ShouldIncludeResource(DemoAppResourceTypes type, IMvcPlugin plugin, object resource)
        {
            bool should = true;
            if (plugin != null)
            {
                if ((should = plugin.Enabled) && plugin is DemoAppPlugin)
                    should = ((DemoAppPlugin)plugin).ShouldIncludeResource(type, resource);
            }

            return should;
        }
 protected virtual bool ShouldIncludeResourceCore(ResourceTypes type, IMvcPlugin plugin)
 {
     return(true);
 }
 protected bool ShouldIncludeResource(ResourceTypes type, IMvcPlugin plugin)
 {
     return(ShouldIncludeResourceCore(type, plugin));
 }
 /// <summary>
 /// Child classes can override this method to add wrapper markup after the widget is rendered.
 /// </summary>
 /// <param name="html"></param>
 /// <param name="widget"></param>
 protected virtual void PostRenderWidget(HtmlHelper html, IMvcPlugin plugin, Widget widget)
 {
     html.ViewContext.Writer.WriteLine("</div>");
 }
 /// <summary>
 /// Child classes can override this method to add wrapper markup before the widget is rendered.
 /// </summary>
 /// <param name="html"></param>
 /// <param name="widget"></param>
 protected virtual void PreRenderWidget(HtmlHelper html, IMvcPlugin plugin, Widget widget)
 {
     html.ViewContext.Writer.WriteLine("<div class='{0}'>", BaseMvcPluginApplication.WidgetCssClassName);
 }
        public void RegisterMenuItem(string menuName, string location, IBasicMenuItem item, IMvcPlugin plugin, string[] views)
        {
            if (string.IsNullOrWhiteSpace(menuName))
                menuName = "main";

            if (views == null || views.Length == 0)
                views = new string[] { "*" };

            lock (m_registeredMenuItems)
            {
                m_registeredMenuItems.Add(new PluginMenuItem() { Plugin = plugin, MenuItem = item, Views = views, MenuLocation = location, MenuName = menuName }, location);
            }
        }
示例#10
0
 protected override bool ShouldIncludeResourceCore(BaseMvcPluginApplication.ResourceTypes type, IMvcPlugin plugin)
 {
     return ShouldIncludeResource((DemoAppResourceTypes)type, plugin, null);
 }