本文整理汇总了C#中XhtmlMobileTextWriter类的典型用法代码示例。如果您正苦于以下问题:C# XhtmlMobileTextWriter类的具体用法?C# XhtmlMobileTextWriter怎么用?C# XhtmlMobileTextWriter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XhtmlMobileTextWriter类属于命名空间,在下文中一共展示了XhtmlMobileTextWriter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: 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
示例2: Render
/// <include file='doc\XhtmlBasicTextViewAdapter.uex' path='docs/doc[@for="XhtmlTextViewAdapter.Render"]/*' />
public override void Render(XhtmlMobileTextWriter writer) {
int beginElement = Control.FirstVisibleElementIndex;
int beginOffset = Control.FirstVisibleElementOffset;
int endElement = Control.LastVisibleElementIndex;
int endOffset = Control.LastVisibleElementOffset;
// ConditionalClearCachedEndTag() is for a device special case.
ConditionalClearCachedEndTag(writer, Control.Text);
ConditionalEnterStyle(writer, Style);
ConditionalRenderOpeningSpanElement(writer);
writer.WritePendingBreak();
for(int i = beginElement; i <= endElement; i++) {
int begin = (i == beginElement) ? beginOffset : 0;
int end;
if (i == endElement) {
if (endOffset <= begin) {
break;
}
end = endOffset;
}
else {
end = -1;
}
RenderElement(writer, i, begin, end);
}
// 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,代码行数:32,代码来源:XhtmlBasicTextViewAdapter.cs
示例3: RenderPostBackEventAsAnchor
// For convenience in extensibility -not used internally. The overload with style and cssClass args is
// to be preferred. See ASURT 144034.
/// <include file='doc\XhtmlBasicControlAdapter.uex' path='docs/doc[@for="XhtmlControlAdapter.RenderPostBackEventAsAnchor1"]/*' />
protected virtual void RenderPostBackEventAsAnchor (
XhtmlMobileTextWriter writer,
String argument,
String linkText,
String accessKey) {
RenderPostBackEventAsAnchor(writer, argument, linkText, accessKey, null /* style */, null /* cssClass */);
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:10,代码来源:XhtmlBasicControlAdapter.cs
示例4: RenderList
/// <include file='doc\XhtmlBasicListAdapter.uex' path='docs/doc[@for="XhtmlListAdapter.RenderList"]/*' />
protected virtual void RenderList (XhtmlMobileTextWriter writer) {
MobileListItemCollection items = Control.Items;
if (items.Count == 0) {
return;
}
ListDecoration decoration = Control.Decoration;
// Review: Consider replacing switch.
switch (decoration) {
case ListDecoration.Bulleted:
RenderBulletedList (writer);
break;
case ListDecoration.Numbered:
RenderNumberedList (writer);
break;
default:
if (!Device.Tables) {
RenderUndecoratedList(writer);
return;
}
RenderTableList (writer);
break;
}
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:26,代码来源:XhtmlBasicListAdapter.cs
示例5: Render
/// <include file='doc\XhtmlBasicSelectionListAdapter.uex' path='docs/doc[@for="XhtmlSelectionListAdapter.Render"]/*' />
public override void Render(XhtmlMobileTextWriter writer) {
// Assumption: XhtmlBasic devices all support tables (conforming to spec).
if (Control.Items.Count == 0) {
return;
}
if ((String) Device[XhtmlConstants.RequiresOnEnterForward] == "true") {
AddOnEnterForward(writer);
}
int selectedIndex = Control.SelectedIndex;
switch(Control.SelectType) {
case ListSelectType.DropDown:
case ListSelectType.ListBox:
case ListSelectType.MultiSelectListBox:
RenderSelectElement (writer);
break;
case ListSelectType.Radio:
case ListSelectType.CheckBox:
RenderInputElementSet (writer);
break;
}
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:28,代码来源:XhtmlBasicSelectionListAdapter.cs
示例6: Render
/// <include file='doc\XhtmlBasicPanelAdapter.uex' path='docs/doc[@for="XhtmlPanelAdapter.Render"]/*' />
public override void Render(XhtmlMobileTextWriter writer) {
if (Control.Content != null) {
Control.Content.RenderControl(writer);
}
else {
ConditionalEnterStyle(writer, Style);
ConditionalRenderOpeningDivElement(writer);
RenderChildren(writer);
ConditionalSetPendingBreak(writer);
ConditionalRenderClosingDivElement(writer);
ConditionalExitStyle(writer, Style);
}
}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:14,代码来源:XhtmlBasicPanelAdapter.cs
示例7: 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
示例8: 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
示例9: Render
/// <include file='doc\XhtmlBasicCommandAdapter.uex' path='docs/doc[@for="XhtmlCommandAdapter.Render"]/*' />
public override void Render(XhtmlMobileTextWriter writer) {
// Note: Since XHTML Basic and MP do not include the script element, we ignore the
// Format==Link attribute as in CHTML.
ConditionalClearPendingBreak(writer);
string imageUrl = Control.ImageUrl;
if (imageUrl != null &&
imageUrl.Length > 0 &&
Device.SupportsImageSubmit) {
RenderAsInputTypeImage(writer);
}
else {
RenderAsInputTypeSubmit(writer);
}
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:15,代码来源:XhtmlBasicCommandAdapter.cs
示例10: 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
示例11: Render
/// <include file='doc\XhtmlBasicListAdapter.uex' path='docs/doc[@for="XhtmlListAdapter.Render"]/*' />
public override void Render (XhtmlMobileTextWriter writer) {
if (Control.HasControls()) {
ConditionalRenderOpeningDivElement(writer);
RenderChildren (writer);
ConditionalRenderClosingDivElement(writer);
return;
}
if (Control.Items.Count != 0) {
ClearPendingBreakIfDeviceBreaksOnBlockLevel(writer); // we are writing a block level element in all cases.
}
ConditionalEnterLayout(writer, Style);
RenderList (writer);
ConditionalExitLayout(writer, Style);
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:15,代码来源:XhtmlBasicListAdapter.cs
示例12: 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
示例13: 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
示例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: AddOnEnterForward
private void AddOnEnterForward(XhtmlMobileTextWriter writer) {
if (Control.SelectType == ListSelectType.CheckBox) {
// ASURT 142732
writer.AddOnEnterForwardSetVar(Control.UniqueID);
return;
}
bool firstIndex = true;
StringBuilder builder = new StringBuilder();
for (int i = 0; i < Control.Items.Count; i++) {
if (Control.Items[i].Selected) {
if (!firstIndex) {
builder.Append(";");
}
builder.Append(i.ToString(CultureInfo.InvariantCulture));
firstIndex = false;
}
}
writer.AddOnEnterForwardSetVar(Control.UniqueID, builder.ToString());
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:19,代码来源:XhtmlBasicSelectionListAdapter.cs
示例16: 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
示例17: 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
示例18: 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
示例19: RenderUndecoratedList
private void RenderUndecoratedList (XhtmlMobileTextWriter writer) {
String br = writer.UseDivsForBreaks ? "</div><div>" : "<br/>";
if((string)Device["usePOverDiv"] == "true")
br = "<br/>";
RenderListBody (writer, "", br);
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:6,代码来源:XhtmlBasicListAdapter.cs
示例20: 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
注:本文中的XhtmlMobileTextWriter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论