Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / MIT / System / Web / UI / MobileControls / Adapters / XhtmlAdapters / XhtmlBasicImageAdapter.cs / 1305376 / XhtmlBasicImageAdapter.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
using System;
using System.Security.Permissions;
using System.Web.Mobile;
using System.Web.UI.MobileControls;
using System.Web.UI.MobileControls.Adapters;
#if COMPILING_FOR_SHIPPED_SOURCE
namespace System.Web.UI.MobileControls.ShippedAdapterSource.XhtmlAdapters
#else
namespace System.Web.UI.MobileControls.Adapters.XhtmlAdapters
#endif
{
///
[AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermission(SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal)]
[Obsolete("The System.Web.Mobile.dll assembly has been deprecated and should no longer be used. For information about how to develop ASP.NET mobile applications, see http://go.microsoft.com/fwlink/?LinkId=157231.")]
public class XhtmlImageAdapter : XhtmlControlAdapter {
///
protected new Image Control {
get {
return base.Control as Image;
}
}
///
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);
}
}
///
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(" />");
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
using System;
using System.Security.Permissions;
using System.Web.Mobile;
using System.Web.UI.MobileControls;
using System.Web.UI.MobileControls.Adapters;
#if COMPILING_FOR_SHIPPED_SOURCE
namespace System.Web.UI.MobileControls.ShippedAdapterSource.XhtmlAdapters
#else
namespace System.Web.UI.MobileControls.Adapters.XhtmlAdapters
#endif
{
///
[AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermission(SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal)]
[Obsolete("The System.Web.Mobile.dll assembly has been deprecated and should no longer be used. For information about how to develop ASP.NET mobile applications, see http://go.microsoft.com/fwlink/?LinkId=157231.")]
public class XhtmlImageAdapter : XhtmlControlAdapter {
///
protected new Image Control {
get {
return base.Control as Image;
}
}
///
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);
}
}
///
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(" />");
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SafeEventLogReadHandle.cs
- Rights.cs
- UInt16.cs
- Translator.cs
- XmlAnyAttributeAttribute.cs
- ToolStripButton.cs
- RequestResponse.cs
- SurrogateEncoder.cs
- HttpDictionary.cs
- TextServicesCompartment.cs
- AsymmetricAlgorithm.cs
- ListCollectionView.cs
- BindingFormattingDialog.cs
- LinqDataSourceInsertEventArgs.cs
- ProxyGenerator.cs
- SingleConverter.cs
- ServiceHostFactory.cs
- sqlpipe.cs
- CommandArguments.cs
- CellParaClient.cs
- HijriCalendar.cs
- TextBoxBase.cs
- Header.cs
- SqlConnectionManager.cs
- NameNode.cs
- WpfXamlLoader.cs
- StringFreezingAttribute.cs
- TextFormatterContext.cs
- QuaternionAnimationBase.cs
- AlphaSortedEnumConverter.cs
- XsdDataContractExporter.cs
- ETagAttribute.cs
- SeparatorAutomationPeer.cs
- MultiTrigger.cs
- Gdiplus.cs
- VirtualDirectoryMappingCollection.cs
- ObjectSecurity.cs
- ConditionedDesigner.cs
- DateTime.cs
- SHA1.cs
- BamlStream.cs
- ThemeDirectoryCompiler.cs
- IgnoreSectionHandler.cs
- LogWriteRestartAreaState.cs
- BitSet.cs
- TreeSet.cs
- FlowStep.cs
- ColumnMapCopier.cs
- Event.cs
- DesignerEditorPartChrome.cs
- ReadOnlyTernaryTree.cs
- ArrayTypeMismatchException.cs
- ArcSegment.cs
- EntityCollection.cs
- Bidi.cs
- OutKeywords.cs
- SafeCoTaskMem.cs
- PointLightBase.cs
- MimeTextImporter.cs
- SqlNotificationRequest.cs
- ObjectListComponentEditor.cs
- ConnectionInterfaceCollection.cs
- VersionedStream.cs
- AccessDataSourceView.cs
- CategoryValueConverter.cs
- filewebresponse.cs
- Model3DGroup.cs
- SamlEvidence.cs
- WebControl.cs
- SQLSingleStorage.cs
- XmlTextWriter.cs
- Vector3DCollectionConverter.cs
- DiscreteKeyFrames.cs
- XappLauncher.cs
- Pool.cs
- InheritanceAttribute.cs
- DelegateBodyWriter.cs
- TextSimpleMarkerProperties.cs
- HelpPage.cs
- ProfilePropertyNameValidator.cs
- SqlCacheDependencyDatabaseCollection.cs
- RegexTypeEditor.cs
- ResourceReferenceExpressionConverter.cs
- RSAPKCS1SignatureDeformatter.cs
- AssemblyCollection.cs
- BitmapVisualManager.cs
- ResourcesChangeInfo.cs
- DragEvent.cs
- ButtonAutomationPeer.cs
- WindowVisualStateTracker.cs
- TypeReference.cs
- DbProviderFactory.cs
- Menu.cs
- CheckedPointers.cs
- ProfileEventArgs.cs
- ClickablePoint.cs
- ReferencedAssembly.cs
- safesecurityhelperavalon.cs
- SerialReceived.cs
- InternalEnumValidator.cs