Exemplo n.º 1
0
        internal void Execute(View RootView)
        {
            // Setup self
            this.RootView = RootView;
            this.Context = RootView.Context;
            this.Html = RootView.Html;
            this.Output = RootView.Output;

            // Run the template
            OnExecute();

            this.Output = null;
        }
Exemplo n.º 2
0
        public void Render(ControllerContext ctx, object model, View innerView, bool runStartPage)
        {
            // Check model type matches on strongly typed views
            CheckDoesModelTypeMatch(ViewType, model==null ? null : model.GetType());

            // Create the view
            var viewbase = (View)Activator.CreateInstance(ViewType);

            // Pass it the view context
            viewbase.Context = ctx;
            viewbase.Model = model;
            viewbase.Html = new HtmlHelper(ctx);
            viewbase.InnerView = innerView;
            viewbase.StartPage = runStartPage ? Owner.CreateStartView() : null;

            // Execute it!
            viewbase.Execute();
        }
Exemplo n.º 3
0
        static Action FindSection(View view, string name)
        {
            if (view==null)
                return null;

            Action section;
            if (view.Sections.TryGetValue(name, out section))
                return section;

            // Recurse
            return FindSection(view.InnerView,name);
        }