当前位置: 首页>>代码示例>>C#>>正文


C# XhtmlMobileTextWriter.Write方法代码示例

本文整理汇总了C#中XhtmlMobileTextWriter.Write方法的典型用法代码示例。如果您正苦于以下问题:C# XhtmlMobileTextWriter.Write方法的具体用法?C# XhtmlMobileTextWriter.Write怎么用?C# XhtmlMobileTextWriter.Write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在XhtmlMobileTextWriter的用法示例。


在下文中一共展示了XhtmlMobileTextWriter.Write方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Render

        /// <include file='doc\XhtmlBasicTextBoxAdapter.uex' path='docs/doc[@for="XhtmlTextBoxAdapter.Render"]/*' />
        public override void Render(XhtmlMobileTextWriter writer) {
            ConditionalClearPendingBreak(writer);
            ConditionalEnterStyle(writer, Style);
            ConditionalRenderOpeningSpanElement(writer);

            if ((String) Device[XhtmlConstants.RequiresOnEnterForward] == "true") {
                writer.AddOnEnterForwardSetVar(Control.UniqueID, Control.Text);
            }
            
            writer.WriteBeginTag("input");

            writer.WriteAttribute("name", Control.UniqueID);

            ConditionalRenderCustomAttribute(writer, XhtmlConstants.AccessKeyCustomAttribute);
            String controlText = Control.Text;
            if (controlText != null && controlText.Length > 0 && !Control.Password) {
                writer.Write(" value=\"");
                writer.WriteEncodedText(controlText);
                writer.Write("\"");
            }

            if (Control.Size > 0) {
                writer.WriteAttribute("size", Control.Size.ToString(CultureInfo.InvariantCulture));
            }

            if (Control.MaxLength > 0) {
                writer.WriteAttribute("maxlength", Control.MaxLength.ToString(CultureInfo.InvariantCulture));
            }

            String requiresType = Device["requiresInputTypeAttribute"];
            if (Control.Password) {
                writer.WriteAttribute("type", "password");
            }
            // InvariantCulture not needed, but included for best practices.
            else if (requiresType != null && String.Equals(requiresType, "true", StringComparison.OrdinalIgnoreCase)) {
                writer.WriteAttribute("type", "text");
            }


            writer.Write("/>");
            // ConditionalSetPendingBreak should always be called *before* ConditionalExitStyle.
            // ConditionalExitStyle may render a block element and clear the pending break.
            ConditionalSetPendingBreakAfterInline(writer);            
            ConditionalRenderClosingSpanElement(writer);
            ConditionalExitStyle(writer, Style);
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:47,代码来源:XhtmlBasicTextBoxAdapter.cs

示例2: RenderAsInputTypeImage

 private void RenderAsInputTypeImage(XhtmlMobileTextWriter writer) {
     ConditionalEnterStyle(writer, Style);
     writer.WriteBeginTag("input");
     writer.WriteAttribute("type", "image");
     writer.WriteAttribute("name", Control.UniqueID);
     writer.WriteAttribute("src", Control.ResolveUrl(Control.ImageUrl), true);
     writer.WriteAttribute("alt", Control.Text, true);
     ConditionalRenderClassAttribute(writer);
     ConditionalRenderCustomAttribute(writer, XhtmlConstants.AccessKeyCustomAttribute);
     writer.Write("/>");
     // ConditionalSetPendingBreak should always be called *before* ConditionalExitStyle.
     // ConditionalExitStyle may render a block element and clear the pending break.
     ConditionalSetPendingBreakAfterInline(writer);
     ConditionalExitStyle(writer, Style);
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:15,代码来源:XhtmlBasicCommandAdapter.cs

示例3: RenderRule

 private void RenderRule (XhtmlMobileTextWriter writer, Color foreColor, int columnSpan) {
     if (CssLocation == StyleSheetLocation.PhysicalFile || Device["requiresXhtmlCssSuppression"] == "true") {
         // Review: Since, if there is a physical stylesheet, we cannot know the intended foreColor,
         // do not render a rule.
         return;
     }
     writer.Write("<tr>");
     Style hruleStyle = new Style();
     // Rendering <td...> with background color equal to the style's forecolor renders a thin
     // rule with color forecolor, as intended.
     hruleStyle[Style.BackColorKey] = foreColor == Color.Empty ? Color.Black : foreColor;
     NameValueCollection additionalAttributes = new NameValueCollection();
     additionalAttributes["colspan"] = columnSpan.ToString(CultureInfo.InvariantCulture);              
     writer.EnterStyleInternal(hruleStyle, "td", StyleFilter.BackgroundColor, additionalAttributes);
     writer.ExitStyle(Style);
     writer.WriteEndTag("tr");            
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:17,代码来源:XhtmlBasicObjectListAdapter.cs

示例4: 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>");
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:40,代码来源:XhtmlBasicObjectListAdapter.cs

示例5: 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>");
         }
     }
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:18,代码来源:XhtmlBasicObjectListAdapter.cs

示例6: 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("[&nbsp;");

            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("&nbsp;|&nbsp;");
            }
            String controlBCT = Control.BackCommandText;
            String backCommandText = (controlBCT == null || controlBCT.Length == 0) ?
                GetDefaultLabel(BackLabel) :
                controlBCT;

            RenderPostBackEventAsAnchor(writer, BackToList, backCommandText, null /* accessKey */, subCommandStyle, subCommandClass);
            writer.Write("&nbsp;]");
            ConditionalExitStyle(writer, subCommandStyleNoItalic);
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:58,代码来源:XhtmlBasicObjectListAdapter.cs

示例7: RenderOpeningListTag

        /////////////////////////////////////////////////////////////////////////
        // SPECIALIZED UTILITY METHODS FOR LIST SELECTIONLIST OBJECTLIST
        /////////////////////////////////////////////////////////////////////////

        // tagname can be any of table, ul, ol.  See the list adapters for examples.
        /// <include file='doc\XhtmlBasicControlAdapter.uex' path='docs/doc[@for="XhtmlControlAdapter.RenderOpeningListTag"]/*' />
        protected virtual void RenderOpeningListTag(XhtmlMobileTextWriter writer, String tagName) {            
            String classAttribute = (String) Control.CustomAttributes[XhtmlConstants.CssClassCustomAttribute];
            if (CssLocation == StyleSheetLocation.PhysicalFile && (String)Device[XhtmlConstants.RequiresXhtmlCssSuppression] != "true") {
                writer.WritePendingBreak();
                writer.WriteBeginTag(tagName);            
                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(">");
            }
            else if ((String)Device[XhtmlConstants.RequiresXhtmlCssSuppression] != "true") {
                writer.WritePendingBreak();
                StyleFilter filter = writer.CurrentStyleClass.GetFilter(Style);
                writer.EnterStyle(new XhtmlFormatStyleClass(Style, filter), tagName);
            }
            else {
                writer.WritePendingBreak();
                writer.WriteFullBeginTag(tagName);
            }
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:31,代码来源:XhtmlBasicControlAdapter.cs

示例8: RenderCookielessDataDictionaryInQueryString

 private void RenderCookielessDataDictionaryInQueryString (XhtmlMobileTextWriter writer, bool queryStringWritten) {
     IDictionary dictionary = PageAdapter.CookielessDataDictionary;
     if (dictionary != null) {
         foreach (String name in dictionary.Keys) {
             if (queryStringWritten) {
                 String amp = (String)Device[XhtmlConstants.SupportsUrlAttributeEncoding] != "false" ? "&amp;" : "&";
                 writer.Write(amp);
             }
             else {
                 writer.Write ('?');
                 queryStringWritten = true;
             }
             writer.Write (name);
             writer.Write ('=');
             writer.Write (dictionary[name]);
         }
     }
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:18,代码来源:XhtmlBasicControlAdapter.cs

示例9: RenderOpeningBodyElement

 private void RenderOpeningBodyElement(XhtmlMobileTextWriter writer) {
     Form activeForm = Page.ActiveForm;
     Style formStyle = ((ControlAdapter)activeForm.Adapter).Style;
     if (CssLocation == StyleSheetLocation.PhysicalFile) {
         String cssClass = (String) activeForm.CustomAttributes[XhtmlConstants.CssClassCustomAttribute];
         writer.WriteBeginTag("body");
         if (cssClass != null  && (String)Device["supportsBodyClassAttribute"] != "false") {
             writer.WriteAttribute("class", cssClass, true /* encode */);
             writer.PushPhysicalCssClass(cssClass);
             _pushedCssClassForBody = true;
         }
         writer.Write(">");
     }
     else if ((String)Device[XhtmlConstants.RequiresXhtmlCssSuppression] != "true" &&
         (String)Device[XhtmlConstants.SupportsBodyClassAttribute] != "false") {
         writer.EnterStyle(formStyle, "body");
     }
     else {
         writer.WriteFullBeginTag("body");    
         if ((String)Device[XhtmlConstants.RequiresXhtmlCssSuppression] != "true" &&
             (String)Device[XhtmlConstants.SupportsBodyClassAttribute] == "false") {
             writer.SetBodyStyle(formStyle);
         }
     }
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:25,代码来源:XhtmlBasicPageAdapter.cs

示例10: RenderHiddenVariablesInUrl

 private void RenderHiddenVariablesInUrl(XhtmlMobileTextWriter writer) {
     if (Page.HasHiddenVariables()) {
         String hiddenVariablePrefix = MobilePage.HiddenVariablePrefix;
         foreach (DictionaryEntry entry in Page.HiddenVariables) {
             writer.Write("&amp;");
             writer.WriteUrlParameter(hiddenVariablePrefix + (String)entry.Key,
                 (String)entry.Value);
         }
     }
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:10,代码来源:XhtmlBasicPageAdapter.cs

示例11: 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(); 
     }
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:18,代码来源:XhtmlBasicPageAdapter.cs

示例12: 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();
            }
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:24,代码来源:XhtmlBasicPageAdapter.cs

示例13: RenderAsInputTypeSubmit

 private void RenderAsInputTypeSubmit(XhtmlMobileTextWriter writer){
     ConditionalEnterStyle(writer, Style);
     writer.WriteBeginTag("input");
     writer.WriteAttribute("type", "submit");
     writer.WriteAttribute("name", Control.UniqueID);
     writer.WriteAttribute("value", Control.Text, true);
     ConditionalRenderClassAttribute(writer);
     ConditionalRenderCustomAttribute(writer, XhtmlConstants.AccessKeyCustomAttribute);
     writer.Write("/>");
     // ConditionalSetPendingBreak should always be called *before* ConditionalExitStyle.
     // ConditionalExitStyle may render a block element and clear the pending break.
     ConditionalSetPendingBreakAfterInline(writer);
     ConditionalPopPhysicalCssClass(writer);
     ConditionalExitStyle(writer, Style);
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:15,代码来源:XhtmlBasicCommandAdapter.cs

示例14: RenderImage

        /// <include file='doc\XhtmlBasicImageAdapter.uex' path='docs/doc[@for="XhtmlImageAdapter.RenderImage"]/*' />
        protected virtual void RenderImage(XhtmlMobileTextWriter writer) {
            String source = Control.ImageUrl;
            writer.WriteBeginTag("img");
            if(source != null && source.Length > 0) {
                source = Page.Server.UrlPathEncode(Control.ResolveUrl(source.Trim()));
                writer.WriteAttribute("src", source, true);
                writer.AddResource(source);
            }

            String alternateText = Control.AlternateText;
            if (alternateText == null || alternateText.Length == 0) {
                alternateText = " "; // ASURT 143759 and VSWhidbey 78593
            }
            writer.WriteAttribute("alt", alternateText, true);
            
            // Review: Html adapter writes border=0 attribute, but don't need this here?
            writer.Write(" />");
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:19,代码来源:XhtmlBasicImageAdapter.cs

示例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(">");            
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:23,代码来源:XhtmlBasicControlAdapter.cs


注:本文中的XhtmlMobileTextWriter.Write方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。