コード例 #1
0
        public override void Process(string templateName, TextWriter output, IEngineContext context, IController controller, IControllerContext controllerContext)
        {
            // Get the main, entry-point, view instance
            IViewBaseInternal view = GetView(templateName, output, context, controller, controllerContext);

            // create layout views if needed. The entry point is changed to the outer-most layout.
            // each layout on the way holds its containing layout on the ContentView property,
            // down to the original entry-point.
            if (controllerContext.LayoutNames != null)
            {
                var layoutNames = controllerContext.LayoutNames;
                for (var i = layoutNames.Length - 1; i >= 0; --i)
                {
                    var layoutName           = layoutNames[i].Trim();
                    IViewBaseInternal layout = GetLayout(layoutName, output, context, controller, controllerContext);
                    layout.ContentView = view;
                    view = layout;
                }
            }
            if (controller != null)
            {
                controller.PreSendView(view);
            }

            // initialize the entry point
            view.Initialize(this, output, context, controller, controllerContext, null);

            // initialize inner layouts down to the original entry-point
            var parent = view;
            var backtraceLayoutsToMainView = view.ContentView;

            while (backtraceLayoutsToMainView != null)
            {
                backtraceLayoutsToMainView.Initialize(this, output, context, controller, controllerContext, parent.Properties);
                parent = backtraceLayoutsToMainView;
                backtraceLayoutsToMainView = parent.ContentView;
            }
            InitializeViewsStack(context);
            // process the view
            view.Process();
            if (controller != null)
            {
                controller.PostSendView(view);
            }
        }
コード例 #2
0
 protected void InitializeView(IViewBaseInternal viewInstance)
 {
     viewInstance.Initialize(engine, writer, context, controller, controllerContext);
 }
コード例 #3
0
		protected void InitializeView(IViewBaseInternal viewInstance)
		{
			viewInstance.Initialize(engine, writer, context, controller, controllerContext, null);
		}