本文整理汇总了C#中XhtmlMobileTextWriter.WriteXmlDeclaration方法的典型用法代码示例。如果您正苦于以下问题:C# XhtmlMobileTextWriter.WriteXmlDeclaration方法的具体用法?C# XhtmlMobileTextWriter.WriteXmlDeclaration怎么用?C# XhtmlMobileTextWriter.WriteXmlDeclaration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XhtmlMobileTextWriter
的用法示例。
在下文中一共展示了XhtmlMobileTextWriter.WriteXmlDeclaration方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Render
/// <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 ();
}