Пример #1
0
        public HelperResult RenderSectionEx(string name, bool required = false, Func <dynamic, HelperResult> defHelperResult = null)
        {
            if (_stoped || PageData.ContainsKey("_Stop"))
            {
                return(null);
            }

            //encapsula o resultado da section num novo resultado
            return(new HelperResult(writer =>
            {
                using (writer.BeginChunk("div", string.Format("{0}_{1}", this.VirtualPath, name), true, "section"))
                {
                    try
                    {
                        var result = RenderSection(name, required);
                        if (result != null)
                        {
                            var @out = result.ToHtmlString();
                            writer.Write(@out);
                        }
                        else if (defHelperResult != null)
                        {
                            var def = defHelperResult(writer);
                            writer.Write(def);
                        }
                    }
                    catch
                    {
                        //já foi renderizado
                    }
                }
            }));
        }
Пример #2
0
        private FunctionContextContainer GetFunctionContext()
        {
            if (!PageData.ContainsKey(RazorHelper.PageContext_FunctionContextContainer))
            {
                return(null);
            }

            return(PageData[RazorHelper.PageContext_FunctionContextContainer]);
        }
Пример #3
0
        public override void ExecutePageHierarchy()
        {
            if (_stoped || PageData.ContainsKey(Stop))
            {
                return;
            }

            using (DisposableTimer.StartNew("CustomWebViewPage: " + this.VirtualPath))
            {
                if (IsAjax || string.IsNullOrWhiteSpace(Layout))
                {
                    base.ExecutePageHierarchy();
                    return;
                }

                using (Output.BeginChunk("div", VirtualPath, false, "view"))
                {
                    base.ExecutePageHierarchy();
                }
            }
        }