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


C# XhtmlMobileTextWriter.WriteEncodedText方法代码示例

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


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

示例1: Render

 /// <include file='doc\XhtmlBasicLinkAdapter.uex' path='docs/doc[@for="XhtmlLinkAdapter.Render"]/*' />
 public override void Render(XhtmlMobileTextWriter writer) {
     ConditionalClearPendingBreak(writer);
     ConditionalEnterStyle(writer, Style);
     String cssClass = GetCustomAttributeValue(XhtmlConstants.CssClassCustomAttribute);
     String accessKey = GetCustomAttributeValue(XhtmlConstants.AccessKeyCustomAttribute);
     RenderBeginLink(writer, Control.NavigateUrl, accessKey, Style, cssClass);
     String controlText = Control.Text;
     writer.WriteEncodedText(controlText == null || controlText.Length == 0 ? Control.NavigateUrl : controlText);
     RenderEndLink(writer);
     // 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,代码来源:XhtmlBasicLinkAdapter.cs

示例2: Render

        /// <include file='doc\XhtmlBasicValidationSummaryAdapter.uex' path='docs/doc[@for="XhtmlValidationSummaryAdapter.Render"]/*' />
        public override void Render(XhtmlMobileTextWriter writer) {
            String[] errorMessages = null;

            if (Control.Visible) {
                errorMessages = Control.GetErrorMessages();
            }

            if (errorMessages != null) {
                ConditionalEnterStyle(writer, Style, "div");
                ConditionalRenderOpeningDivElement(writer);
                if (Control.HeaderText.Length > 0) {
                    // ConditionalClearCachedEndTag() is for a device special case.
                    ConditionalClearCachedEndTag(writer, Control.HeaderText);
                    writer.WriteEncodedText (Control.HeaderText);
                }

                ArrayList arr = new ArrayList();
                foreach (String errorMessage in errorMessages) {
                    Debug.Assert(errorMessage != null && errorMessage.Length > 0, "Bad Error Messages");
                    arr.Add(errorMessage);
                }

                _list.Decoration = ListDecoration.Bulleted;
                _list.DataSource = arr;
                _list.DataBind();

                if (String.Compare(Control.FormToValidate, Control.Form.UniqueID, true, CultureInfo.CurrentCulture) != 0) {
                    _link.NavigateUrl = Constants.FormIDPrefix + Control.FormToValidate;
                    String controlBackLabel = Control.BackLabel;
                    _link.Text = controlBackLabel == null || controlBackLabel.Length == 0 ? GetDefaultLabel(BackLabel) : controlBackLabel;
                    // Summary writes its own break so last control should write one.
                    _link.BreakAfter = false;
                    ((IAttributeAccessor)_link).SetAttribute(XhtmlConstants.AccessKeyCustomAttribute, GetCustomAttributeValue(XhtmlConstants.AccessKeyCustomAttribute));
                }
                else {
                    _link.Visible = false;
                    // Summary writes its own break so last control should write one.
                    _list.BreakAfter = false;
                }

                // Render the child controls to display error message list and a
                // link for going back to the Form that is having error
                RenderChildren(writer);
                // ConditionalSetPendingBreak should always be called *before* ConditionalExitStyle.
                // ConditionalExitStyle may render a block element and clear the pending break.
                ConditionalSetPendingBreak(writer);            
                ConditionalRenderClosingDivElement(writer);
                ConditionalExitStyle(writer, Style);
            }
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:51,代码来源:XhtmlBasicValidationSummaryAdapter.cs

示例3: Render

 /// <include file='doc\XhtmlBasicValidatorAdapter.uex' path='docs/doc[@for="XhtmlValidatorAdapter.Render"]/*' />
 public override void Render(XhtmlMobileTextWriter writer) {
     if (!Control.IsValid && Control.Display != WebControls.ValidatorDisplay.None) {
         ConditionalEnterStyle(writer, Style);
         ConditionalRenderOpeningSpanElement(writer);
         writer.WritePendingBreak();
         String controlText = Control.Text;
         String controlErrorMessage = Control.ErrorMessage;
         if (controlText != null & controlText.Length > 0) {
             // ConditionalClearCachedEndTag() is for a device special case.
             ConditionalClearCachedEndTag(writer, Control.Text);
             writer.WriteEncodedText (Control.Text);
         }
         else if (controlErrorMessage != null && controlErrorMessage.Length > 0) {
             ConditionalClearCachedEndTag(writer, Control.ErrorMessage);
             writer.WriteEncodedText (Control.ErrorMessage);
         }
         // 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);
     }
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:24,代码来源:XhtmlBasicValidatorAdapter.cs

示例4: Render

 /// <include file='doc\XhtmlBasicLiteralTextAdapter.uex' path='docs/doc[@for="XhtmlLiteralTextAdapter.Render"]/*' />
 public override void Render(XhtmlMobileTextWriter writer) {
     // ConditionalClearCachedEndTag() is for a device special case.
     ConditionalClearCachedEndTag(writer, Control.Text);
     String text = Control.PagedText;
     ConditionalEnterStyle(writer, Style);
     ConditionalRenderOpeningSpanElement(writer);
     writer.WritePendingBreak();
     writer.WriteEncodedText(text);
     // 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);
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:15,代码来源:XhtmlBasicLiteralTextAdapter.cs

示例5: 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

示例6: Render

        /// <include file='doc\XhtmlBasicImageAdapter.uex' path='docs/doc[@for="XhtmlImageAdapter.Render"]/*' />
        public override void Render(XhtmlMobileTextWriter writer) {
            string target = Control.NavigateUrl;
            ConditionalClearPendingBreak(writer);
            Style style = Style;
            StyleFilter filter = writer.CurrentStyleClass.GetFilter(style);
            if ((filter & XhtmlConstants.Layout) != 0) {
                ConditionalEnterLayout(writer, style);
            }

            if(target != null && target.Length > 0) {
                String cssClass = GetCustomAttributeValue(XhtmlConstants.CssClassCustomAttribute);
                String accessKey = GetCustomAttributeValue(XhtmlConstants.AccessKeyCustomAttribute);
                String title = GetCustomAttributeValue(XhtmlConstants.TitleCustomAttribute);
                RenderBeginLink(writer, target, accessKey, style, cssClass, title);
            }
            else{
                ConditionalEnterFormat(writer, style);
                ConditionalRenderOpeningSpanElement(writer);
            }
            String controlIU = Control.ImageUrl;
            if(controlIU == null || controlIU.Length == 0) {            
                writer.WriteEncodedText(Control.AlternateText);
            }
            else {
                RenderImage(writer);
            }
            ConditionalSetPendingBreakAfterInline(writer);
            if(target != null && target.Length > 0) {
                RenderEndLink(writer);
            }
            else {
                ConditionalRenderClosingSpanElement(writer);
                ConditionalExitFormat(writer, style);
            }
            if ((filter & XhtmlConstants.Layout) != 0) {
                ConditionalExitLayout(writer, style);
            }
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:39,代码来源:XhtmlBasicImageAdapter.cs

示例7: 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

示例8: 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

示例9: RenderPostBackEventAsAnchor

 // For Style/CssClass args, see ASURT 144034
 /// <include file='doc\XhtmlBasicControlAdapter.uex' path='docs/doc[@for="XhtmlControlAdapter.RenderPostBackEventAsAnchor2"]/*' />
 protected virtual void RenderPostBackEventAsAnchor (
     XhtmlMobileTextWriter writer,
     String argument,
     String linkText, 
     String accessKey,
     Style style,
     String cssClass) {            
     writer.WriteBeginTag("a");
     writer.Write(" href=\"");
     PageAdapter.RenderUrlPostBackEvent(writer, Control.UniqueID /* target */, argument);
     writer.Write("\" ");
     if (accessKey != null && accessKey.Length > 0) {
         writer.WriteAttribute("accesskey", accessKey);
     }
     if ((String)Device[XhtmlConstants.RequiresXhtmlCssSuppression] != "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 */);
         }
     }
     writer.Write(">");
     writer.WriteEncodedText(linkText);
     writer.WriteEndTag("a");
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:31,代码来源:XhtmlBasicControlAdapter.cs

示例10: RenderHrefValue

        // Writes the href value for RenderBeginLink, depending on whether the target is a new form on the 
        // current page or a standard url (e.g., a new page).
        private void RenderHrefValue (XhtmlMobileTextWriter writer, String target) {
            bool appendCookielessDataDictionary = PageAdapter.PersistCookielessData  && 
                !target.StartsWith("http:", StringComparison.Ordinal) && 
                !target.StartsWith("https:", StringComparison.Ordinal);
            bool queryStringWritten = false;

            // ASURT 144021
            if (target == null || target.Length == 0) {
                target = Page.Response.ApplyAppPathModifier(Control.TemplateSourceDirectory);
            }



            if (target.StartsWith(Constants.FormIDPrefix, StringComparison.Ordinal)) {
                RenderFormNavigationHrefValue (writer, target);
                appendCookielessDataDictionary = false;
            }
            else {
                // For page adapter Control = null.
                if (Control != null) {
                    target = Control.ResolveUrl(target);
                }
                
                // ASURT 147179
                if ((String)Device["requiresAbsolutePostbackUrl"] == "true"
                    && IsRelativeUrl(target)) {
                    String templateSourceDirectory = Page.TemplateSourceDirectory;
                    String prefix = writer.EncodeUrlInternal(Page.Response.ApplyAppPathModifier(Page.TemplateSourceDirectory));
                    if (prefix[prefix.Length - 1] != '/') {
                        prefix = prefix + '/';
                    }
                    target = prefix + target;
                }

                if ((String)Device[XhtmlConstants.SupportsUrlAttributeEncoding] != "false") {
                    writer.WriteEncodedText (target);
                }
                else {
                    writer.Write (target);                
                }
                queryStringWritten = target.IndexOf ('?') != -1;
            }

            if (appendCookielessDataDictionary) {
                RenderCookielessDataDictionaryInQueryString (writer, queryStringWritten);
            }
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:49,代码来源:XhtmlBasicControlAdapter.cs

示例11: 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"  ? "&amp;" : "&";
                    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");
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:79,代码来源:XhtmlBasicFormAdapter.cs

示例12: RenderSelectElement

        void RenderSelectElement (XhtmlMobileTextWriter writer) {
            
            if ((String)Device["supportsSelectFollowingTable"] == "false" && writer.CachedEndTag == "table") {
                writer.Write("&nbsp;");
            }

            ConditionalEnterStyle(writer, Style);
            writer.WriteBeginTag ("select");

            if (Control.SelectType == ListSelectType.MultiSelectListBox) {
                writer.WriteAttribute ("multiple", "multiple");
            }

            if (Control.SelectType == ListSelectType.ListBox || Control.SelectType == ListSelectType.MultiSelectListBox) {
                writer.WriteAttribute ("size", Control.Rows.ToString(CultureInfo.InvariantCulture));
            }

            writer.WriteAttribute ("name", Control.UniqueID);
            ConditionalRenderClassAttribute(writer);
            writer.Write (">");

            for (int itemIndex = 0; itemIndex < Control.Items.Count; itemIndex++) {
                MobileListItem item = Control.Items[itemIndex];
                writer.WriteBeginTag ("option");
                WriteItemValueAttribute (writer, itemIndex, item.Value);
                if (item.Selected && (Control.IsMultiSelect || itemIndex == Control.SelectedIndex)) {
                    writer.Write (" selected=\"selected\">");
                }
                else {
                    writer.Write (">");
                }
                writer.WriteEncodedText (item.Text);
                writer.WriteLine ("</option>");
            }
            ConditionalSetPendingBreak(writer);
            writer.WriteEndTag ("select");            
            writer.WriteLine ();      
            ConditionalPopPhysicalCssClass(writer);
            ConditionalExitStyle(writer, Style);
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:40,代码来源:XhtmlBasicSelectionListAdapter.cs

示例13: RenderListItem

 private void RenderListItem (XhtmlMobileTextWriter writer, MobileListItem item) {
     String accessKey = GetCustomAttributeValue(item, XhtmlConstants.AccessKeyCustomAttribute);
     String cssClass = GetCustomAttributeValue(item, XhtmlConstants.CssClassCustomAttribute);
     if (Control.ItemsAsLinks) {
         RenderBeginLink (writer, item.Value, accessKey, Style, cssClass);
         writer.WriteEncodedText (item.Text);
         RenderEndLink (writer);
     }
     else if (Control.HasItemCommandHandler) {
         RenderPostBackEventAsAnchor (writer, 
             item.Index.ToString(CultureInfo.InvariantCulture) /*event argument*/, 
             item.Text /*link text*/,
             accessKey,
             Style,
             cssClass);
     }
     else {
         writer.WriteEncodedText (item.Text);
     }
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:20,代码来源:XhtmlBasicListAdapter.cs

示例14: Render

        /// <include file='doc\XhtmlBasicPhoneCallAdapter.uex' path='docs/doc[@for="XhtmlPhoneCallAdapter.Render"]/*' />
        public override void Render(XhtmlMobileTextWriter writer)
        {
            ConditionalClearPendingBreak(writer);
            Style style = Style;
            StyleFilter filter = writer.CurrentStyleClass.GetFilter(style);
            if ((filter & XhtmlConstants.Layout) != 0) {
                ConditionalEnterLayout(writer, style);
            }
            if (Device.CanInitiateVoiceCall) {
                String text = Control.Text;
                String phoneNumber = Control.PhoneNumber;

                if (text == null || text.Length == 0) {
                    text = phoneNumber;
                }

                writer.WriteBeginTag("a");

                if ((String)Device["supportsWtai"] == "true") {
                    writer.Write(" href=\"wtai://wp/mc;");
                }
                else {
                    writer.Write(" href=\"tel:");
                }

                foreach (char ch in phoneNumber) {
                    if (ch >= '0' && ch <= '9' || ch == '#' || ch == '+') {
                        writer.Write(ch);
                    }
                }
                writer.Write("\"");
                ConditionalRenderCustomAttribute(writer, XhtmlConstants.AccessKeyCustomAttribute);
                String cssClass = GetCustomAttributeValue(XhtmlConstants.CssClassCustomAttribute);
                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 */);
                }
                writer.Write(">");
                writer.WriteEncodedText(text);
                writer.WriteEndTag("a");
                ConditionalSetPendingBreakAfterInline(writer);
            }
            else {
                // Format the text string based on properties
                String text = String.Format(
                    CultureInfo.CurrentCulture,
                    Control.AlternateFormat,
                    Control.Text,
                    Control.PhoneNumber);
                String url = Control.AlternateUrl;

                // If URI specified, create a link.  Otherwise, only text is displayed.
                if (url != null && url.Length > 0) {
                    String cssClass = GetCustomAttributeValue(XhtmlConstants.CssClassCustomAttribute);
                    String accessKey = GetCustomAttributeValue(XhtmlConstants.AccessKeyCustomAttribute);
                    RenderBeginLink(writer, url, accessKey, style, cssClass);
                    writer.WriteEncodedText(text);
                    RenderEndLink(writer);
                    ConditionalSetPendingBreakAfterInline(writer);
                }
                else {
                    writer.WritePendingBreak();
                    ConditionalEnterFormat(writer, style);
                    ConditionalRenderOpeningSpanElement(writer);
                    writer.WriteEncodedText(text);
                    ConditionalRenderClosingSpanElement(writer);
                    ConditionalExitFormat(writer, style);
                    ConditionalSetPendingBreak(writer);
                }
            }
            if ((filter & XhtmlConstants.Layout) != 0) {
                ConditionalExitLayout(writer, style);
            }
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:80,代码来源:XhtmlBasicPhoneCallAdapter.cs

示例15: RenderElement

 /// <include file='doc\XhtmlBasicTextViewAdapter.uex' path='docs/doc[@for="XhtmlTextViewAdapter.RenderElement"]/*' />
 public void RenderElement(XhtmlMobileTextWriter writer, int index, int beginSubstring, int endSubstring) {
     TextViewElement element = Control.GetElement(index);
     writer.WritePendingBreak();
     if (endSubstring == -1) {
         endSubstring = element.Text.Length;
     }
     String text = element.Text;
     if (beginSubstring > 0 || endSubstring < text.Length) {
         text = text.Substring(beginSubstring, endSubstring - beginSubstring);
     }
     BooleanOption prevBold = Style.Font.Bold;
     BooleanOption prevItalic = Style.Font.Italic;
     if (element.IsBold) {
         Style.Font.Bold = BooleanOption.True;
     }
     if (element.IsItalic) {
         Style.Font.Italic = BooleanOption.True;
     }
     ConditionalEnterStyle(writer, Style);           
     if (element.Url != null) {
         RenderBeginLink(writer, element.Url);
         writer.WriteEncodedText(text);
         RenderEndLink(writer);
     }
     else {
         writer.WriteEncodedText(text);
     }
     if (element.BreakAfter) {
         writer.SetPendingBreak();
     }
     ConditionalExitStyle(writer, Style);
     Style.Font.Bold = prevBold;
     Style.Font.Italic = prevItalic;
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:35,代码来源:XhtmlBasicTextViewAdapter.cs


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