Exemplo n.º 1
0
        public override IWriteResult WriteBodyArea(IRenderContext context)
        {
            var html = context.Html;

            // Save this location in the output buffer
            var begining = html.CreateInsertionPoint();

            // Write a paragraph of text
            html.WriteElementLine("p", "This is a semi custom page", "class", "normal");

            // Use the saved buffer location to write the heading before the paragraph
            // and do this in a separate thread
            var task = Task.Factory.StartNew(() =>
            {
                // Simulate a call to a service or database here
                Thread.Sleep(10);

                begining.WriteElementLine("h1", "Semi Custom", "class", "page-heading");
            });

            // Write a second paragraph of text
            html.WriteElementLine("p", "My second paragraph of text", "class", "normal");

            return(WriteResult.WaitFor(task));
        }