Exemple #1
0
 private void setView(MethodInfo method)
 {
     if (this.GetType().IsSubclassOf(method.DeclaringType))
     {
         String filePath = MvcUtil.getParentViewPath(method, ctx.route.getRootNamespace(method.DeclaringType.FullName));
         this.utils.setCurrentView(this.utils.getTemplateByFileName(filePath));
     }
     else
     {
         view(method.Name);
     }
 }
Exemple #2
0
        //------------------------------------------------------------------------

        private void setControllerView(ControllerBase controller, MethodInfo actionMethod)
        {
            // 控制器继承
            if (actionMethod.DeclaringType != controller.GetType())
            {
                String filePath = MvcUtil.getParentViewPath(actionMethod, controller.ctx.route.getRootNamespace(actionMethod.DeclaringType.FullName));
                controller.utils.setCurrentView(controller.utils.getTemplateByFileName(filePath));
            }
            else
            {
                controller.view(controller.ctx.route.action);
            }
        }
Exemple #3
0
        private String runCurrentLayout(ControllerBase controller, MvcContext ctx, ProcessContext context, String actionContent)
        {
            MethodInfo layoutMethod = controller.utils.getMethod("Layout");

            if (layoutMethod.DeclaringType != controller.GetType())
            {
                String filePath = MvcUtil.getParentViewPath(layoutMethod, ctx.route.getRootNamespace(layoutMethod.DeclaringType.FullName));
                controller.utils.setCurrentView(controller.utils.getTemplateByFileName(filePath));
            }
            else
            {
                controller.utils.switchViewToLayout();
            }

            controller.actionContent("");   // 清理当前内容,否则下面的utils.getActionResult()得不到正确结果
            controller.Layout();

            return(controller.utils.getActionResult());
        }