public virtual IWriteResult WritePageArea( IRenderContext renderContext, PageArea pageArea) { var writeResult = WriteResult.Continue(); #if TRACE renderContext.Trace(() => "Writing the page " + Enum.GetName(typeof(PageArea), pageArea)); renderContext.TraceIndent(); try { #endif if (pageArea == PageArea.Title) { if (ReferenceEquals(TitleFunc, null)) { if (_layout != null) { writeResult.Add(_layout.WritePageArea(renderContext, PageArea.Title)); } } else { renderContext.Html.Write(TitleFunc(renderContext)); return(writeResult); } } switch (pageArea) { case PageArea.Head: writeResult.Add(WriteHeadArea(renderContext)); break; case PageArea.Styles: writeResult.Add(WriteStylesArea(renderContext)); break; case PageArea.Scripts: writeResult.Add(WriteScriptsArea(renderContext)); break; case PageArea.Body: writeResult.Add(WriteBodyArea(renderContext)); break; case PageArea.Initialization: writeResult.Add(WriteInitializationArea(renderContext)); break; } if (!ReferenceEquals(_pageComponents, null)) { for (var i = 0; i < _pageComponents.Length; i++) { var pageComponent = _pageComponents[i]; if (writeResult.Add(pageComponent.WritePageArea(renderContext, pageArea)).IsComplete) { return(writeResult); } } } #if TRACE } finally { renderContext.TraceOutdent(); } #endif return(writeResult); }