/// <include file='doc\XhtmlBasicPageAdapter.uex' path='docs/doc[@for="XhtmlPageAdapter.Render"]/*' /> public override void Render (XhtmlMobileTextWriter writer) { writer.BeginResponse (); if (Page.Request.Browser["requiresPragmaNoCacheHeader"] == "true") { Page.Response.AppendHeader("Pragma", "no-cache"); } InitWriterState(writer); writer.BeginCachedRendering (); // For consistency with HTML, we render the form style with body tag. RenderOpeningBodyElement(writer); // Certain WML 2.0 devices require that we write an onevent onenterforward setvar snippet. // We cannot know the relevant variables until after the form is rendered, so we mark this // position. The setvar elements will be inserted into the cached rendering here. writer.MarkWmlOnEventLocation (); Page.ActiveForm.RenderControl(writer); RenderClosingBodyElement(writer); writer.ClearPendingBreak (); writer.EndCachedRendering (); // Note: first and third arguments are not used. writer.BeginFile (Page.Request.Url.ToString (), Page.Device.PreferredRenderingMime, Page.Response.Charset); String supportsXmlDeclaration = Device["supportsXmlDeclaration"]; // Invariant culture not needed, included for best practices compliance. if (supportsXmlDeclaration == null || !String.Equals(supportsXmlDeclaration, "false", StringComparison.OrdinalIgnoreCase)) { writer.WriteXmlDeclaration (); } writer.WriteDoctypeDeclaration(DocumentType); // Review: Hard coded xmlns. writer.WriteFullBeginTag ("html xmlns=\"http://www.w3.org/1999/xhtml\""); writer.WriteLine (); writer.WriteFullBeginTag ("head"); writer.WriteLine (); writer.WriteFullBeginTag ("title"); if (Page.ActiveForm.Title != null) { writer.WriteEncodedText(Page.ActiveForm.Title); } writer.WriteEndTag ("title"); ConditionalRenderLinkElement (writer); ConditionalRenderStyleElement (writer); writer.WriteEndTag ("head"); writer.WriteLine (); writer.WriteCachedMarkup (); // includes body tag. writer.WriteLine (); writer.WriteEndTag ("html"); writer.EndFile (); if (!DoesDeviceRequireCssSuppression()) { if (CssLocation == StyleSheetLocation.ApplicationCache && !writer.IsStyleSheetEmpty()) { // Recall that Page.Cache has application scope Page.Cache.Insert(writer.CacheKey, writer.GetStyles (), null, DateTime.MaxValue, _cacheExpirationTime); } else if (CssLocation == StyleSheetLocation.SessionState && !writer.IsStyleSheetEmpty()) { Page.Session[writer.SessionKey] = writer.GetStyles(); } } writer.EndResponse (); }
/// <include file='doc\XhtmlBasicPageAdapter.uex' path='docs/doc[@for="XhtmlPageAdapter.Render"]/*' /> public override void Render(XhtmlMobileTextWriter writer) { writer.BeginResponse(); if (Page.Request.Browser["requiresPragmaNoCacheHeader"] == "true") { Page.Response.AppendHeader("Pragma", "no-cache"); } InitWriterState(writer); writer.BeginCachedRendering(); // For consistency with HTML, we render the form style with body tag. RenderOpeningBodyElement(writer); // Certain WML 2.0 devices require that we write an onevent onenterforward setvar snippet. // We cannot know the relevant variables until after the form is rendered, so we mark this // position. The setvar elements will be inserted into the cached rendering here. writer.MarkWmlOnEventLocation(); Page.ActiveForm.RenderControl(writer); RenderClosingBodyElement(writer); writer.ClearPendingBreak(); writer.EndCachedRendering(); // Note: first and third arguments are not used. writer.BeginFile(Page.Request.Url.ToString(), Page.Device.PreferredRenderingMime, Page.Response.Charset); String supportsXmlDeclaration = Device["supportsXmlDeclaration"]; // Invariant culture not needed, included for best practices compliance. if (supportsXmlDeclaration == null || !String.Equals(supportsXmlDeclaration, "false", StringComparison.OrdinalIgnoreCase)) { writer.WriteXmlDeclaration(); } writer.WriteDoctypeDeclaration(DocumentType); // Review: Hard coded xmlns. writer.WriteFullBeginTag("html xmlns=\"http://www.w3.org/1999/xhtml\""); writer.WriteLine(); writer.WriteFullBeginTag("head"); writer.WriteLine(); writer.WriteFullBeginTag("title"); if (Page.ActiveForm.Title != null) { writer.WriteEncodedText(Page.ActiveForm.Title); } writer.WriteEndTag("title"); ConditionalRenderLinkElement(writer); ConditionalRenderStyleElement(writer); writer.WriteEndTag("head"); writer.WriteLine(); writer.WriteCachedMarkup(); // includes body tag. writer.WriteLine(); writer.WriteEndTag("html"); writer.EndFile(); if (!DoesDeviceRequireCssSuppression()) { if (CssLocation == StyleSheetLocation.ApplicationCache && !writer.IsStyleSheetEmpty()) { // Recall that Page.Cache has application scope Page.Cache.Insert(writer.CacheKey, writer.GetStyles(), null, DateTime.MaxValue, _cacheExpirationTime); } else if (CssLocation == StyleSheetLocation.SessionState && !writer.IsStyleSheetEmpty()) { Page.Session[writer.SessionKey] = writer.GetStyles(); } } writer.EndResponse(); }