本文整理汇总了C#中XhtmlMobileTextWriter.WriteLine方法的典型用法代码示例。如果您正苦于以下问题:C# XhtmlMobileTextWriter.WriteLine方法的具体用法?C# XhtmlMobileTextWriter.WriteLine怎么用?C# XhtmlMobileTextWriter.WriteLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XhtmlMobileTextWriter
的用法示例。
在下文中一共展示了XhtmlMobileTextWriter.WriteLine方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Render
/// <include file='doc\XhtmlBasicLabelAdapter.uex' path='docs/doc[@for="XhtmlLabelAdapter.Render"]/*' />
public override void Render(XhtmlMobileTextWriter writer) {
// ConditionalClearCachedEndTag() is for a device special case.
ConditionalClearCachedEndTag(writer, Control.Text);
ConditionalEnterStyle(writer, Style);
ConditionalRenderOpeningSpanElement(writer);
writer.WritePendingBreak();
writer.WriteEncodedText(Control.Text);
writer.WriteLine ();
// ConditionalSetPendingBreak should always be called *before* ConditionalExitStyle.
// ConditionalExitStyle may render a block element and clear the pending break.
ConditionalSetPendingBreak(writer);
ConditionalRenderClosingSpanElement(writer);
ConditionalExitStyle(writer, Style);
}
示例2: RenderListViewItem
// Render a single ObjectListItem in list view.
private void RenderListViewItem (XhtmlMobileTextWriter writer, ObjectListItem item, int fieldCount, int[] fieldIndices, bool itemRequiresMoreButton, bool itemRequiresHyperlink) {
Style style = Style;
Style subCommandStyle = Control.CommandStyle;
String accessKey = GetCustomAttributeValue(item, XhtmlConstants.AccessKeyCustomAttribute);
String cssClass = GetCustomAttributeValue(item, XhtmlConstants.CssClassCustomAttribute);
String subCommandClass = GetCustomAttributeValue(XhtmlConstants.CssCommandClassCustomAttribute);
if (subCommandClass == null || subCommandClass.Length == 0) {
subCommandClass = cssClass;
}
writer.WriteLine("<tr>");
// Render fields.
for (int field = 0; field < fieldCount; field++) {
writer.Write("<td>");
if (field == 0 && itemRequiresHyperlink) {
String eventArgument = HasDefaultCommand() ? item.Index.ToString(CultureInfo.InvariantCulture) : String.Format(CultureInfo.InvariantCulture, ShowMoreFormat, item.Index.ToString(CultureInfo.InvariantCulture));
RenderPostBackEventAsAnchor(writer, eventArgument, item[fieldIndices[0]], accessKey, Style, cssClass);
}
else {
writer.WriteEncodedText (item[fieldIndices[field]]);
}
writer.WriteLine("</td>");
}
if (itemRequiresMoreButton) {
writer.Write("<td>");
String controlMT = Control.MoreText;
String moreText = (controlMT == null || controlMT.Length == 0) ? GetDefaultLabel(MoreLabel) : controlMT;
RenderPostBackEventAsAnchor(writer,
String.Format(CultureInfo.InvariantCulture, ShowMoreFormat, item.Index),
moreText,
null /*accessKey*/,
subCommandStyle,
subCommandClass);
writer.WriteLine("</td>");
}
writer.WriteLine("</tr>");
}
示例3: RenderItemFieldsInDetailsView
// Called from RenderItemDetails. (Extracted for intelligibility.)
private void RenderItemFieldsInDetailsView (XhtmlMobileTextWriter writer, ObjectListItem item) {
Style style = Style;
IObjectListFieldCollection fields = Control.AllFields;
foreach (ObjectListField field in fields) {
if (field.Visible) {
writer.Write("<tr><td>");
ConditionalEnterStyle(writer, Style);
writer.WriteEncodedText (field.Title);
ConditionalExitStyle(writer, Style);
writer.Write("</td><td>");
ConditionalEnterStyle(writer, style);
writer.WriteEncodedText (item [fields.IndexOf (field)]);
ConditionalExitStyle(writer, style);
writer.WriteLine("</td></tr>");
}
}
}
示例4: RenderItemDetails
// Render the details view
/// <include file='doc\XhtmlBasicObjectListAdapter.uex' path='docs/doc[@for="XhtmlObjectListAdapter.RenderItemDetails"]/*' />
protected virtual void RenderItemDetails(XhtmlMobileTextWriter writer, ObjectListItem item) {
if (Control.AllFields.Count == 0) {
return;
}
if (!Device.Tables) {
RenderItemDetailsWithoutTableTags(writer, item);
return;
}
Style labelStyle = Control.LabelStyle;
Style subCommandStyle = Control.CommandStyle;
Style subCommandStyleNoItalic = (Style)subCommandStyle.Clone();
subCommandStyleNoItalic.Font.Italic = BooleanOption.False;
writer.ClearPendingBreak(); // we are writing a block level element in all cases.
ConditionalEnterLayout(writer, Style);
writer.WriteBeginTag ("table");
ConditionalRenderClassAttribute(writer);
writer.Write(">");
writer.Write("<tr><td colspan=\"2\">");
ConditionalEnterStyle(writer, labelStyle);
writer.WriteEncodedText (item[Control.LabelFieldIndex]);
ConditionalExitStyle(writer, labelStyle);
writer.WriteLine("</td></tr>");
Color foreColor = (Color)Style[Style.ForeColorKey, true];
RenderRule (writer, foreColor, 2);
RenderItemFieldsInDetailsView (writer, item);
RenderRule (writer, foreColor, 2);
ConditionalPopPhysicalCssClass(writer);
writer.WriteEndTag("table");
ConditionalExitLayout(writer, Style);
ConditionalEnterStyle(writer, subCommandStyleNoItalic);
writer.Write("[ ");
ObjectListCommandCollection commands = Control.Commands;
String cssClass = GetCustomAttributeValue(XhtmlConstants.CssClassCustomAttribute);
String subCommandClass = GetCustomAttributeValue(XhtmlConstants.CssCommandClassCustomAttribute);
if (subCommandClass == null || subCommandClass.Length == 0) {
subCommandClass = cssClass;
}
foreach (ObjectListCommand command in commands) {
RenderPostBackEventAsAnchor(writer, command.Name, command.Text, null /* accessKey */, subCommandStyle, subCommandClass);
writer.Write(" | ");
}
String controlBCT = Control.BackCommandText;
String backCommandText = (controlBCT == null || controlBCT.Length == 0) ?
GetDefaultLabel(BackLabel) :
controlBCT;
RenderPostBackEventAsAnchor(writer, BackToList, backCommandText, null /* accessKey */, subCommandStyle, subCommandClass);
writer.Write(" ]");
ConditionalExitStyle(writer, subCommandStyleNoItalic);
}
示例5: ConditionalRenderClosingDivElement
// Render closing </div> in case the stylesheet location has been specified as a physical file.
/// <include file='doc\XhtmlBasicControlAdapter.uex' path='docs/doc[@for="XhtmlControlAdapter.ConditionalRenderClosingDivElement"]/*' />
protected virtual void ConditionalRenderClosingDivElement(XhtmlMobileTextWriter writer) {
if ((String)Device[XhtmlConstants.RequiresXhtmlCssSuppression] == "true") {
return;
}
String classAttribute = (String) Control.CustomAttributes[XhtmlConstants.CssClassCustomAttribute];
if (CssLocation == StyleSheetLocation.PhysicalFile) {
writer.WriteLine();
if ((String)Device["usePOverDiv"] == "true") {
writer.WriteEndTag("p");
}
else {
writer.WriteEndTag("div");
}
writer.WriteLine();
ConditionalPopPhysicalCssClass(writer);
}
}
示例6: ConditionalRenderOpeningDivElement
// Render opening <div class=...> in case the stylesheet location has been specified as a physical file.
/// <include file='doc\XhtmlBasicControlAdapter.uex' path='docs/doc[@for="XhtmlControlAdapter.ConditionalRenderOpeningDivElement"]/*' />
protected virtual void ConditionalRenderOpeningDivElement(XhtmlMobileTextWriter writer) {
if ((String)Device[XhtmlConstants.RequiresXhtmlCssSuppression] == "true") {
return;
}
String classAttribute = (String) Control.CustomAttributes[XhtmlConstants.CssClassCustomAttribute];
if (CssLocation == StyleSheetLocation.PhysicalFile) {
writer.WriteLine();
if ((String)Device["usePOverDiv"] == "true") {
writer.WriteBeginTag("p");
}
else {
writer.WriteBeginTag("div");
}
if (classAttribute != null &&
classAttribute.Length > 0 &&
writer.DiffersFromCurrentPhysicalCssClass(classAttribute)) {
writer.WriteAttribute("class", classAttribute, true);
writer.PushPhysicalCssClass(classAttribute);
Debug.Assert(!_physicalCssClassPushed, "These calls should not be nested.");
_physicalCssClassPushed = true;
}
writer.Write(">");
}
}
示例7: ConditionalRenderClosingSpanElement
// Render closing </span> in case the stylesheet location has been specified as a physical file.
/// <include file='doc\XhtmlBasicControlAdapter.uex' path='docs/doc[@for="XhtmlControlAdapter.ConditionalRenderClosingSpanElement"]/*' />
protected virtual void ConditionalRenderClosingSpanElement(XhtmlMobileTextWriter writer) {
String classAttribute = (String) Control.CustomAttributes[XhtmlConstants.CssClassCustomAttribute];
if (_physicalSpanClassOpen) {
Debug.Assert(_physicalCssClassPushed, "_physicalSpanClassOpen implies _physicalCssClassPushed");
writer.WriteEndTag("span");
writer.WriteLine();
ConditionalPopPhysicalCssClass(writer); // resets _physicalCssClassPushed
_physicalSpanClassOpen = false;
}
}
示例8: Render
/// <include file='doc\XhtmlBasicFormAdapter.uex' path='docs/doc[@for="XhtmlFormAdapter.Render"]/*' />
public override void Render (XhtmlMobileTextWriter writer) {
// Note: <head>, <body> rendered by page adapter, as in HTML case.
String formsAuthCookieName = FormsAuthentication.FormsCookieName;
if(!Device.SupportsRedirectWithCookie)
{
if(formsAuthCookieName != null && formsAuthCookieName.Length > 0)
{
HttpContext.Current.Response.Cookies.Remove(formsAuthCookieName);
}
}
writer.WriteBeginTag ("form");
writer.WriteAttribute ("id", Control.ClientID);
writer.WriteAttribute ("method", Control.Method.ToString().ToLower(CultureInfo.CurrentCulture));
writer.Write (" action=\"");
RenderPostbackUrl(writer);
if(Control.Action.Length > 0) {
if(Control.Action.IndexOf("?", StringComparison.Ordinal) != -1) {
writer.Write("&");
}
else {
writer.Write("?");
}
}
else {
writer.Write("?");
}
writer.Write(Page.UniqueFilePathSuffix);
if (Control.Method != FormMethod.Get &&
Control.Action.Length == 0) { // VSWhidbey 411176: We don't include QueryStringText if Action is explicitly set
String queryStringText = PreprocessQueryString(Page.QueryStringText);
if (queryStringText != null && queryStringText.Length > 0) {
String amp = (String)Device[XhtmlConstants.SupportsUrlAttributeEncoding] != "false" ? "&" : "&";
writer.Write(amp);
if((String)Device[XhtmlConstants.SupportsUrlAttributeEncoding] != "false") {
writer.WriteEncodedText(queryStringText);
}
else {
writer.Write(queryStringText);
}
}
}
writer.WriteLine ("\">");
bool needDivStyle = (String)Device[XhtmlConstants.RequiresXhtmlCssSuppression] != "true" &&
(String)Device["supportsBodyClassAttribute"] == "false";
if (!needDivStyle) {
if((String)Device["usePOverDiv"] == "true")
writer.WriteFullBeginTag("p");
else
writer.WriteFullBeginTag ("div");
}
else {
if((String)Device["usePOverDiv"] == "true")
writer.EnterStyle(Style, "p");
else
writer.EnterStyle (Style, "div");
}
RenderPostBackHeader (writer);
// Renders hidden variables for IPostBackDataHandlers which are
// not displayed due to pagination or secondary UI.
RenderOffPageVariables(writer, Control, Control.CurrentPage);
RenderChildren (writer);
if (!needDivStyle) {
if((String)Device["usePOverDiv"] == "true")
writer.WriteEndTag("p");
else
writer.WriteEndTag ("div");
}
else {
if((String)Device["usePOverDiv"] == "true")
writer.ExitStyle(Style);
else
writer.ExitStyle (Style);
}
writer.WriteEndTag ("form");
}
示例9: OpenSecondaryUIDivs
private void OpenSecondaryUIDivs(XhtmlMobileTextWriter writer, Control control) {
Control ctl = control.Parent as MobileControl;
while (ctl != null) {
String cssClass = ((IAttributeAccessor) ctl).GetAttribute(XhtmlConstants.CssClassCustomAttribute);
if (cssClass != null && cssClass. Length > 0) {
if((String)Device["usePOverDiv"] == "true") {
writer.WriteBeginTag("p");
}
else {
writer.WriteBeginTag("div");
}
writer.WriteAttribute("class", cssClass, true);
writer.WriteLine(">");
_secondaryUIDivsOpened++;
}
ctl = ctl.Parent as MobileControl;
}
}
示例10: CloseSecondaryUIDivs
private void CloseSecondaryUIDivs(XhtmlMobileTextWriter writer) {
for (int i = 0; i < _secondaryUIDivsOpened; i++) {
if((String)Device["usePOverDiv"] == "true") {
writer.WriteEndTag("p");
}
else {
writer.WriteEndTag("div");
}
writer.WriteLine();
}
}
示例11: 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 ();
}
示例12: ConditionalRenderStyleElement
private void ConditionalRenderStyleElement (XhtmlMobileTextWriter writer) {
if (!writer.IsStyleSheetEmpty () && CssLocation == StyleSheetLocation.Internal) {
bool requiresComments = (String)Device["requiresCommentInStyleElement"] == "true";
writer.WriteLine();
writer.WriteBeginTag("style");
writer.Write(" type=\"text/css\">");
writer.WriteLine();
if (requiresComments) {
writer.WriteLine("<!--");
}
writer.Write(writer.GetStyles());
if (requiresComments) {
writer.WriteLine("-->");
}
writer.WriteEndTag("style");
writer.WriteLine();
}
}
示例13: ConditionalRenderLinkElement
private void ConditionalRenderLinkElement (XhtmlMobileTextWriter writer) {
if (DoesDeviceRequireCssSuppression()) {
return;
}
String cssLocation = (String) Page.ActiveForm.CustomAttributes[XhtmlConstants.StyleSheetLocationCustomAttribute];
if (cssLocation != null &&
cssLocation.Length != 0) {
writer.WriteBeginTag ("link");
writer.WriteAttribute ("type", "text/css");
writer.WriteAttribute ("rel", "stylesheet");
writer.WriteAttribute("href", cssLocation, true);
writer.WriteLine("/>");
}
else if (!writer.IsStyleSheetEmpty () && CssLocation!=StyleSheetLocation.Internal) {
writer.WriteLine ();
writer.WriteBeginTag ("link");
writer.WriteAttribute ("type", "text/css");
writer.WriteAttribute ("rel", "stylesheet");
String queryStringValue = GetCssQueryStringValue(writer);
writer.Write(" href=\"" + XhtmlConstants.CssMappedFileName + "?" + XhtmlConstants.CssQueryStringName + "=" + queryStringValue + "\"/>");
writer.WriteLine();
}
}
示例14: RenderListViewTableHeader
private void RenderListViewTableHeader (XhtmlMobileTextWriter writer, int fieldCount, int[] fieldIndices, bool itemRequiresMoreButton){
String cssClass = GetCustomAttributeValue(XhtmlConstants.CssClassCustomAttribute);
String labelClass = GetCustomAttributeValue(XhtmlConstants.CssLabelClassCustomAttribute);
if (labelClass == null || labelClass.Length == 0) {
labelClass = cssClass;
}
writer.WriteLine("<tr>");
for (int field = 0; field < fieldCount; field++) {
writer.WriteBeginTag("td");
if (CssLocation == StyleSheetLocation.PhysicalFile && labelClass != null && labelClass.Length > 0) {
writer.WriteAttribute("class", labelClass, true);
}
writer.Write(">");
Style labelStyle = Control.LabelStyle;
ConditionalEnterStyle(writer, labelStyle);
writer.WriteEncodedText(Control.AllFields[fieldIndices[field]].Title);
ConditionalExitStyle(writer, labelStyle);
writer.Write("</td>");
}
if (itemRequiresMoreButton) {
writer.WriteLine("<td/>");
}
writer.WriteLine();
writer.WriteLine("</tr>");
}
示例15: RenderBeginLink
/// <include file='doc\XhtmlBasicControlAdapter.uex' path='docs/doc[@for="XhtmlControlAdapter.RenderBeginLink"]/*' />
protected virtual void RenderBeginLink(XhtmlMobileTextWriter writer, String target, String accessKey, Style style, String cssClass, String title) {
writer.WriteBeginTag("a");
writer.Write(" href=\"");
RenderHrefValue (writer, target);
writer.Write("\"");
if (accessKey != null && accessKey.Length > 0) {
writer.WriteAttribute("accesskey", accessKey, true);
}
if (CssLocation != StyleSheetLocation.PhysicalFile) {
String className = writer.GetCssFormatClassName(style);
if (className != null) {
writer.WriteAttribute ("class", className);
}
}
else if (cssClass != null && cssClass.Length > 0) {
writer.WriteAttribute ("class", cssClass, true /* encode */);
}
if (title != null && title.Length > 0) {
writer.WriteAttribute("title", title, true /* encode */);
}
writer.WriteLine(">");
}