You've already forked linux-packaging-mono
Imported Upstream version 4.6.0.125
Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
This commit is contained in:
parent
a569aebcfd
commit
e79aa3c0ed
@@ -0,0 +1,323 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <copyright file="AdRotator.cs" company="Microsoft">
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing.Design;
|
||||
using System.Web.Mobile;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.Util;
|
||||
using WebCntrls = System.Web.UI.WebControls;
|
||||
using System.Security.Permissions;
|
||||
|
||||
namespace System.Web.UI.MobileControls
|
||||
{
|
||||
|
||||
/*
|
||||
* Mobile AdRotator class.
|
||||
* The AdRotator control is for rotating advertisement links every time the
|
||||
* same page is revisited.
|
||||
*
|
||||
* This class aggregates the corresponding ASP.NET AdRotator for delegating
|
||||
* the random selection task of advertisement info to the aggregated
|
||||
* class. The ad info is selected during the PreRender phase of the
|
||||
* aggregated control (So the aggregated control needs to have the
|
||||
* property Visible set to true when entering the PreRender process).
|
||||
* For markup adapters that collect the selected ad info for rendering,
|
||||
* they should subscribe to AdCreated event property and collect the ad
|
||||
* info through the event argument.
|
||||
*
|
||||
* This class also contains a mobile Image control for delegating the
|
||||
* rendering since AdRotator's rendering is the same as Image's rendering
|
||||
* by setting the corresponding properties on the control.
|
||||
*
|
||||
* Copyright (c) 2000 Microsoft Corporation
|
||||
*/
|
||||
/// <include file='doc\AdRotator.uex' path='docs/doc[@for="AdRotator"]/*' />
|
||||
[
|
||||
DefaultEvent("AdCreated"),
|
||||
DefaultProperty("AdvertisementFile"),
|
||||
Designer(typeof(System.Web.UI.Design.MobileControls.AdRotatorDesigner)),
|
||||
DesignerAdapter(typeof(System.Web.UI.Design.MobileControls.Adapters.DesignerAdRotatorAdapter)),
|
||||
ToolboxData("<{0}:AdRotator runat=\"server\"></{0}:AdRotator>"),
|
||||
ToolboxItem(typeof(System.Web.UI.Design.WebControlToolboxItem))
|
||||
]
|
||||
[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 AdRotator : MobileControl
|
||||
{
|
||||
private WebCntrls.AdRotator _webAdRotator;
|
||||
private Image _image = new Image();
|
||||
|
||||
private static readonly Object EventAdCreated = new Object();
|
||||
private const String ImageKeyDefault = "ImageUrl";
|
||||
private const String NavigateUrlKeyDefault = "NavigateUrl";
|
||||
|
||||
/// <include file='doc\AdRotator.uex' path='docs/doc[@for="AdRotator.AdRotator"]/*' />
|
||||
public AdRotator() : base()
|
||||
{
|
||||
_webAdRotator = CreateWebAdRotator();
|
||||
|
||||
_image.EnableViewState = false;
|
||||
|
||||
this.Controls.Add(_webAdRotator);
|
||||
this.Controls.Add(_image);
|
||||
|
||||
// The default value of the Target property of the web AdRotator is
|
||||
// set to "_top". Since we are not exposing this property, we need
|
||||
// to explicity set it to empty string so this property will not be
|
||||
// shown in the rendered markup when the web AdRotator is used to do
|
||||
// the rendering.
|
||||
_webAdRotator.Target = String.Empty;
|
||||
|
||||
// Due to the fact that C# compiler doesn't allow direct
|
||||
// manipulation of event properties outside of the class that
|
||||
// defines the event variable, the way we delegate the event
|
||||
// handlers to the aggregated web control is to provide a wrapper
|
||||
// to capture the raised event from the aggregated control and
|
||||
// apply the event argument to the event handlers subscribed to
|
||||
// this class.
|
||||
AdCreatedEventHandler adCreatedEventHandler =
|
||||
new AdCreatedEventHandler(WebAdCreated);
|
||||
|
||||
_webAdRotator.AdCreated += adCreatedEventHandler;
|
||||
}
|
||||
|
||||
/// <include file='doc\AdRotator.uex' path='docs/doc[@for="AdRotator.CreateWebAdRotator"]/*' />
|
||||
protected virtual WebCntrls.AdRotator CreateWebAdRotator()
|
||||
{
|
||||
return new WebCntrls.AdRotator();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Mimic the properties exposed in the original AdRotator.
|
||||
// The properties are got and set directly from the original AdRotator.
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/// <include file='doc\AdRotator.uex' path='docs/doc[@for="AdRotator.AdvertisementFile"]/*' />
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// Gets or sets the path to the XML file that contains advertisement data.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// <para>
|
||||
/// The path to the XML file containing the properties of the advertisements to
|
||||
/// render in the <see langword='AdRotator'/>.
|
||||
/// </para>
|
||||
/// </value>
|
||||
[
|
||||
Bindable(true),
|
||||
DefaultValue(""),
|
||||
Editor(typeof(System.Web.UI.Design.XmlUrlEditor), typeof(UITypeEditor)),
|
||||
MobileCategory(SR.Category_Behavior),
|
||||
MobileSysDescription(SR.AdRotator_AdvertisementFile)
|
||||
]
|
||||
public String AdvertisementFile
|
||||
{
|
||||
get
|
||||
{
|
||||
return _webAdRotator.AdvertisementFile;
|
||||
}
|
||||
set
|
||||
{
|
||||
_webAdRotator.AdvertisementFile = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <include file='doc\AdRotator.uex' path='docs/doc[@for="AdRotator.KeywordFilter"]/*' />
|
||||
/// <summary>
|
||||
/// <para>
|
||||
/// Gets or sets a keyword used to match related advertisements in the ad file.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// <para>
|
||||
/// The keyword used to identify advertisements within a specific catagory.
|
||||
/// </para>
|
||||
/// </value>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// If the ad source is AdvertisementFile and this property is not empty, an ad
|
||||
/// with a matching keyword will be selected.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// If the ad source is AdvertisementFile and this property set, but no match
|
||||
/// exists, a blank image is displayed and a trace warning is generated.
|
||||
/// </para>
|
||||
/// If this property is not set, keyword filtering is not used to select an ad.
|
||||
/// </remarks>
|
||||
[
|
||||
Bindable(true),
|
||||
DefaultValue(""),
|
||||
MobileCategory(SR.Category_Behavior),
|
||||
MobileSysDescription(SR.AdRotator_KeywordFilter)
|
||||
]
|
||||
public String KeywordFilter
|
||||
{
|
||||
get
|
||||
{
|
||||
return _webAdRotator.KeywordFilter;
|
||||
}
|
||||
set
|
||||
{
|
||||
_webAdRotator.KeywordFilter = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <include file='doc\AdRotator.uex' path='docs/doc[@for="AdRotator.ImageKey"]/*' />
|
||||
[
|
||||
Bindable(true),
|
||||
DefaultValue(ImageKeyDefault),
|
||||
MobileCategory(SR.Category_Behavior),
|
||||
MobileSysDescription(SR.AdRotator_ImageKey)
|
||||
]
|
||||
public String ImageKey
|
||||
{
|
||||
get
|
||||
{
|
||||
String s = (String) ViewState["ImageKey"];
|
||||
return((s != null) ? s : ImageKeyDefault);
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["ImageKey"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <include file='doc\AdRotator.uex' path='docs/doc[@for="AdRotator.NavigateUrlKey"]/*' />
|
||||
[
|
||||
Bindable(true),
|
||||
DefaultValue(NavigateUrlKeyDefault),
|
||||
MobileCategory(SR.Category_Behavior),
|
||||
MobileSysDescription(SR.AdRotator_NavigateUrlKey)
|
||||
]
|
||||
public String NavigateUrlKey
|
||||
{
|
||||
get
|
||||
{
|
||||
String s = (String) ViewState["NavigateUrlKey"];
|
||||
return((s != null) ? s : NavigateUrlKeyDefault);
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["NavigateUrlKey"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <include file='doc\AdRotator.uex' path='docs/doc[@for="AdRotator.AdCreated"]/*' />
|
||||
[
|
||||
MobileCategory(SR.Category_Action),
|
||||
MobileSysDescription(SR.AdRotator_AdCreated)
|
||||
]
|
||||
public event AdCreatedEventHandler AdCreated
|
||||
{
|
||||
add
|
||||
{
|
||||
Events.AddHandler(EventAdCreated, value);
|
||||
}
|
||||
remove
|
||||
{
|
||||
Events.RemoveHandler(EventAdCreated, value);
|
||||
}
|
||||
}
|
||||
|
||||
// protected method (which can be overridden by subclasses) for
|
||||
// raising user events
|
||||
/// <include file='doc\AdRotator.uex' path='docs/doc[@for="AdRotator.OnAdCreated"]/*' />
|
||||
protected virtual void OnAdCreated(AdCreatedEventArgs e)
|
||||
{
|
||||
AdCreatedEventHandler handler = (AdCreatedEventHandler)Events[EventAdCreated];
|
||||
if (handler != null)
|
||||
{
|
||||
handler(this, e);
|
||||
}
|
||||
}
|
||||
|
||||
/// <include file='doc\AdRotator.uex' path='docs/doc[@for="AdRotator.Render"]/*' />
|
||||
protected override void Render(HtmlTextWriter writer)
|
||||
{
|
||||
const String accesskeyName = "accesskey";
|
||||
|
||||
// Delegate specific custom attribute to the child Image control
|
||||
String accesskey = ((IAttributeAccessor) this).GetAttribute(accesskeyName);
|
||||
if (!String.IsNullOrEmpty(accesskey))
|
||||
{
|
||||
_image.CustomAttributes[accesskeyName] = accesskey;
|
||||
}
|
||||
|
||||
_image.RenderControl(writer);
|
||||
}
|
||||
|
||||
private void WebAdCreated(Object sender, AdCreatedEventArgs e)
|
||||
{
|
||||
// Override the value since it may have been changed by device
|
||||
// select
|
||||
|
||||
// AdProperties can be null when ad file is not specified
|
||||
// correctly.
|
||||
if (e.AdProperties != null)
|
||||
{
|
||||
e.ImageUrl = (String) e.AdProperties[ImageKey];
|
||||
e.NavigateUrl = (String) e.AdProperties[NavigateUrlKey];
|
||||
}
|
||||
|
||||
// Then invoke user events for further manipulation specified by
|
||||
// user
|
||||
OnAdCreated(e);
|
||||
|
||||
// Finally, set the necessary properties to the base Image class
|
||||
_image.ImageUrl = ResolveAdRotatorUrl(e.ImageUrl);
|
||||
_image.AlternateText = e.AlternateText;
|
||||
_image.NavigateUrl = ResolveAdRotatorUrl(e.NavigateUrl);
|
||||
}
|
||||
|
||||
// Helper function adopted from ASP.NET AdRotator class (modified
|
||||
// slightly)
|
||||
private String ResolveAdRotatorUrl(String relativeUrl)
|
||||
{
|
||||
if (relativeUrl == null)
|
||||
{
|
||||
return String.Empty;
|
||||
}
|
||||
|
||||
// check if it is already absolute, or points to another form
|
||||
if (!UrlPath.IsRelativeUrl(relativeUrl) ||
|
||||
relativeUrl.StartsWith(Constants.FormIDPrefix, StringComparison.Ordinal))
|
||||
{
|
||||
return relativeUrl;
|
||||
}
|
||||
|
||||
// Deal with app relative syntax (e.g. ~/foo)
|
||||
string tplSourceDir = UrlPath.MakeVirtualPathAppAbsolute(TemplateSourceDirectory);
|
||||
|
||||
// For the AdRotator, use the AdvertisementFile directory as the
|
||||
// base, and fall back to the page/user control location as the
|
||||
// base.
|
||||
String absoluteFile = UrlPath.Combine(tplSourceDir,
|
||||
AdvertisementFile);
|
||||
String fileDirectory = UrlPath.GetDirectory(absoluteFile);
|
||||
|
||||
String baseUrl = String.Empty;
|
||||
if (fileDirectory != null)
|
||||
{
|
||||
baseUrl = fileDirectory;
|
||||
}
|
||||
if (baseUrl.Length == 0)
|
||||
{
|
||||
baseUrl = tplSourceDir;
|
||||
}
|
||||
if (baseUrl.Length == 0)
|
||||
{
|
||||
return relativeUrl;
|
||||
}
|
||||
|
||||
// make it absolute
|
||||
return UrlPath.Combine(baseUrl, relativeUrl);
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,41 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <copyright file="ChtmlCommandAdapter.cs" company="Microsoft">
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System.Security.Permissions;
|
||||
|
||||
#if COMPILING_FOR_SHIPPED_SOURCE
|
||||
namespace System.Web.UI.MobileControls.ShippedAdapterSource
|
||||
#else
|
||||
namespace System.Web.UI.MobileControls.Adapters
|
||||
#endif
|
||||
|
||||
{
|
||||
/*
|
||||
* ChtmlCommandAdapter class.
|
||||
*/
|
||||
/// <include file='doc\ChtmlCommandAdapter.uex' path='docs/doc[@for="ChtmlCommandAdapter"]/*' />
|
||||
[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 ChtmlCommandAdapter : HtmlCommandAdapter
|
||||
{
|
||||
/// <include file='doc\ChtmlCommandAdapter.uex' path='docs/doc[@for="ChtmlCommandAdapter.RequiresFormTag"]/*' />
|
||||
public override bool RequiresFormTag
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <include file='doc\ChtmlCommandAdapter.uex' path='docs/doc[@for="ChtmlCommandAdapter.AddAttributes"]/*' />
|
||||
protected override void AddAttributes(HtmlMobileTextWriter writer)
|
||||
{
|
||||
AddAccesskeyAttribute(writer);
|
||||
AddJPhoneMultiMediaAttributes(writer);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,154 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <copyright file="ChtmlFormAdapter.cs" company="Microsoft">
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System.Globalization;
|
||||
using System.Security.Permissions;
|
||||
|
||||
#if COMPILING_FOR_SHIPPED_SOURCE
|
||||
namespace System.Web.UI.MobileControls.ShippedAdapterSource
|
||||
#else
|
||||
namespace System.Web.UI.MobileControls.Adapters
|
||||
#endif
|
||||
|
||||
{
|
||||
/*
|
||||
* ChtmlFormAdapter class.
|
||||
*
|
||||
* Copyright (c) 2000 Microsoft Corporation
|
||||
*/
|
||||
/// <include file='doc\ChtmlFormAdapter.uex' path='docs/doc[@for="ChtmlFormAdapter"]/*' />
|
||||
[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 ChtmlFormAdapter : HtmlFormAdapter
|
||||
{
|
||||
private static readonly String _contentTypeMetaTag = "<meta http-equiv=\"Content-Type\" content=\"{0}; charset={1}\">\r\n";
|
||||
|
||||
/// <include file='doc\ChtmlFormAdapter.uex' path='docs/doc[@for="ChtmlFormAdapter.ShouldRenderFormTag"]/*' />
|
||||
protected override bool ShouldRenderFormTag()
|
||||
{
|
||||
if (!Device.RequiresOutputOptimization || Control.PageCount > 1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return IsFormTagNeeded(Control);
|
||||
}
|
||||
|
||||
// Recursive method to check if there is any descendant control
|
||||
// requires the form tag. For unknown cases, the method returns true
|
||||
// in case the unknown rendering requires the form tag.
|
||||
private bool IsFormTagNeeded(Control control)
|
||||
{
|
||||
// Check itself first
|
||||
if (!control.Visible)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
MobileControl mobileControl = control as MobileControl;
|
||||
if (mobileControl != null)
|
||||
{
|
||||
// Since we don't have control over what content is included
|
||||
// in the template, to be safe we just generate the form tag.
|
||||
if (mobileControl.IsTemplated)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
HtmlControlAdapter adapter = mobileControl.Adapter as HtmlControlAdapter;
|
||||
if (adapter != null && adapter.RequiresFormTag)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (!(control is UserControl) &&
|
||||
!(control is LiteralControl))
|
||||
{
|
||||
// UserControl simply acts as a container, so the checking
|
||||
// should be delegated to its children below.
|
||||
// LiteralControl is a plain text control. Also, it is
|
||||
// generated for the spaces in between mobile control tags so
|
||||
// we don't want to consider it as a form required control.
|
||||
// For other cases, we should generate form tag as we don't
|
||||
// know the content that will be generated.
|
||||
return true;
|
||||
}
|
||||
|
||||
// No problem with the current control so far, now recursively
|
||||
// check its children.
|
||||
if (control.HasControls())
|
||||
{
|
||||
foreach (Control child in control.Controls)
|
||||
{
|
||||
if (IsFormTagNeeded(child))
|
||||
{
|
||||
// This is to get out of recursive loop without
|
||||
// further checking on other controls.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <include file='doc\ChtmlFormAdapter.uex' path='docs/doc[@for="ChtmlFormAdapter.RenderExtraHeadElements"]/*' />
|
||||
protected override bool RenderExtraHeadElements(HtmlMobileTextWriter writer)
|
||||
{
|
||||
bool result = false;
|
||||
|
||||
String metaTagName = Device.RequiredMetaTagNameValue;
|
||||
if (metaTagName != null)
|
||||
{
|
||||
if (writer != null)
|
||||
{
|
||||
writer.Write("<meta NAME=\"" + metaTagName + "\" CONTENT=\"True\">\r\n");
|
||||
}
|
||||
result = true;
|
||||
}
|
||||
|
||||
String charset = Page.Response.Charset;
|
||||
if (Device.RequiresContentTypeMetaTag &&
|
||||
charset != null && charset.Length > 0)
|
||||
{
|
||||
if (writer != null)
|
||||
{
|
||||
writer.Write(String.Format(CultureInfo.InvariantCulture, _contentTypeMetaTag, Device.PreferredRenderingMime, charset));
|
||||
}
|
||||
result = true;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <include file='doc\ChtmlFormAdapter.uex' path='docs/doc[@for="ChtmlFormAdapter.RenderPagerTag"]/*' />
|
||||
protected internal override void RenderPagerTag(
|
||||
HtmlMobileTextWriter writer,
|
||||
int pageToNavigate,
|
||||
String text)
|
||||
{
|
||||
writer.EnterLayout(Style);
|
||||
writer.EnterFormat(Style);
|
||||
writer.WriteBeginTag("input");
|
||||
|
||||
// Specially encode the page number with the control id.
|
||||
// The corresponding code that handles postback should know how
|
||||
// to extract the page number correctly.
|
||||
writer.Write(" name=\"");
|
||||
writer.Write(Control.UniqueID);
|
||||
writer.Write(Constants.PagePrefix);
|
||||
writer.Write(pageToNavigate.ToString(CultureInfo.InvariantCulture));
|
||||
writer.Write("\"");
|
||||
|
||||
writer.WriteAttribute("type", "submit");
|
||||
writer.WriteAttribute("value", text, true);
|
||||
writer.Write("/>");
|
||||
writer.ExitFormat(Style);
|
||||
writer.ExitLayout(Style);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,105 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <copyright file="ChtmlImageAdapter.cs" company="Microsoft">
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System.Globalization;
|
||||
using System.Web.UI.MobileControls.Adapters;
|
||||
using System.Security.Permissions;
|
||||
|
||||
#if COMPILING_FOR_SHIPPED_SOURCE
|
||||
namespace System.Web.UI.MobileControls.ShippedAdapterSource
|
||||
#else
|
||||
namespace System.Web.UI.MobileControls.Adapters
|
||||
#endif
|
||||
|
||||
{
|
||||
/*
|
||||
* ChtmlImageAdapter class.
|
||||
*/
|
||||
/// <include file='doc\ChtmlImageAdapter.uex' path='docs/doc[@for="ChtmlImageAdapter"]/*' />
|
||||
[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 ChtmlImageAdapter : HtmlImageAdapter
|
||||
{
|
||||
/// <include file='doc\ChtmlImageAdapter.uex' path='docs/doc[@for="ChtmlImageAdapter.RenderImage"]/*' />
|
||||
protected internal override void RenderImage(HtmlMobileTextWriter writer)
|
||||
{
|
||||
String source = Control.ImageUrl;
|
||||
|
||||
if (source.StartsWith(Constants.SymbolProtocol, StringComparison.Ordinal) &&
|
||||
(Device.SupportsIModeSymbols || Device.SupportsJPhoneSymbols))
|
||||
{
|
||||
if (Device.SupportsIModeSymbols)
|
||||
{
|
||||
writer.Write("&#");
|
||||
writer.Write(
|
||||
source.Substring(Constants.SymbolProtocol.Length));
|
||||
writer.Write(";");
|
||||
}
|
||||
else
|
||||
{
|
||||
// The ImageUrl should be in the format "symbol:xyyy",
|
||||
// where x is group picture character (either G, E or F),
|
||||
// and yyy (length can vary) is the picture's character
|
||||
// code (in decimal).
|
||||
String symbolChars = source.Substring(
|
||||
Constants.SymbolProtocol.Length);
|
||||
char code = DecimalStringToChar(symbolChars.Substring(1));
|
||||
|
||||
writer.Write("\u001B$");
|
||||
writer.Write(Char.ToUpper(symbolChars[0], CultureInfo.InvariantCulture));
|
||||
writer.Write(code);
|
||||
writer.Write('\u000F');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
base.RenderImage(writer);
|
||||
}
|
||||
}
|
||||
|
||||
// Convert decimal string "xxx" to '\u00xx'
|
||||
private char DecimalStringToChar(String decimalString)
|
||||
{
|
||||
int codeValue = 0;
|
||||
int adj = 1;
|
||||
|
||||
for (int i = decimalString.Length - 1; i >= 0; i--)
|
||||
{
|
||||
codeValue += DecimalCharToInt(decimalString[i]) * adj;
|
||||
adj *= 10;
|
||||
}
|
||||
|
||||
return (char) codeValue;
|
||||
}
|
||||
|
||||
// Convert decimal char 'x' to decimal integer value x
|
||||
private int DecimalCharToInt(char decimalChar)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (decimalChar >= '0' && decimalChar <= '9')
|
||||
{
|
||||
i = decimalChar - '0';
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ArgumentException(
|
||||
SR.GetString(SR.ChtmlImageAdapterDecimalCodeExpectedAfterGroupChar),
|
||||
"ImageUrl");
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
/// <include file='doc\ChtmlImageAdapter.uex' path='docs/doc[@for="ChtmlImageAdapter.AddAttributes"]/*' />
|
||||
protected override void AddAttributes(HtmlMobileTextWriter writer)
|
||||
{
|
||||
AddAccesskeyAttribute(writer);
|
||||
AddJPhoneMultiMediaAttributes(writer);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,32 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <copyright file="ChtmlLinkAdapter.cs" company="Microsoft">
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System.Security.Permissions;
|
||||
|
||||
#if COMPILING_FOR_SHIPPED_SOURCE
|
||||
namespace System.Web.UI.MobileControls.ShippedAdapterSource
|
||||
#else
|
||||
namespace System.Web.UI.MobileControls.Adapters
|
||||
#endif
|
||||
|
||||
{
|
||||
/*
|
||||
* ChtmlLinkAdapter class.
|
||||
*/
|
||||
/// <include file='doc\ChtmlLinkAdapter.uex' path='docs/doc[@for="ChtmlLinkAdapter"]/*' />
|
||||
[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 ChtmlLinkAdapter : HtmlLinkAdapter
|
||||
{
|
||||
/// <include file='doc\ChtmlLinkAdapter.uex' path='docs/doc[@for="ChtmlLinkAdapter.AddAttributes"]/*' />
|
||||
protected override void AddAttributes(HtmlMobileTextWriter writer)
|
||||
{
|
||||
AddAccesskeyAttribute(writer);
|
||||
AddJPhoneMultiMediaAttributes(writer);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,44 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <copyright file="ChtmlMobileTextWriter.cs" company="Microsoft">
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Web;
|
||||
using System.Web.Mobile;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.MobileControls;
|
||||
using System.Security.Permissions;
|
||||
|
||||
#if COMPILING_FOR_SHIPPED_SOURCE
|
||||
namespace System.Web.UI.MobileControls.ShippedAdapterSource
|
||||
#else
|
||||
namespace System.Web.UI.MobileControls.Adapters
|
||||
#endif
|
||||
|
||||
{
|
||||
|
||||
/*
|
||||
* ChtmlMobileTextWriter class.
|
||||
*
|
||||
* Copyright (c) 2000 Microsoft Corporation
|
||||
*/
|
||||
/// <include file='doc\ChtmlMobileTextWriter.uex' path='docs/doc[@for="ChtmlMobileTextWriter"]/*' />
|
||||
[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 ChtmlMobileTextWriter : HtmlMobileTextWriter
|
||||
{
|
||||
/// <include file='doc\ChtmlMobileTextWriter.uex' path='docs/doc[@for="ChtmlMobileTextWriter.ChtmlMobileTextWriter"]/*' />
|
||||
public ChtmlMobileTextWriter(TextWriter writer, MobileCapabilities device)
|
||||
: base(writer, device)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,385 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <copyright file="ChtmlPageAdapter.cs" company="Microsoft">
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System.Collections.Specialized;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Web.Mobile;
|
||||
using System.Web.UI.MobileControls.Adapters;
|
||||
using System.Security.Permissions;
|
||||
|
||||
#if COMPILING_FOR_SHIPPED_SOURCE
|
||||
namespace System.Web.UI.MobileControls.ShippedAdapterSource
|
||||
#else
|
||||
namespace System.Web.UI.MobileControls.Adapters
|
||||
#endif
|
||||
|
||||
{
|
||||
|
||||
/*
|
||||
* ChtmlPageAdapter class.
|
||||
*
|
||||
* Copyright (c) 2000 Microsoft Corporation
|
||||
*/
|
||||
/// <include file='doc\ChtmlPageAdapter.uex' path='docs/doc[@for="ChtmlPageAdapter"]/*' />
|
||||
[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 ChtmlPageAdapter : HtmlPageAdapter
|
||||
{
|
||||
private const int DefaultPageWeight = 800;
|
||||
private const String _postedFromOtherFile = ".";
|
||||
|
||||
/// <include file='doc\ChtmlPageAdapter.uex' path='docs/doc[@for="ChtmlPageAdapter.ChtmlPageAdapter"]/*' />
|
||||
public ChtmlPageAdapter() : base(DefaultPageWeight)
|
||||
{
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
// Static method used for determining if device should use
|
||||
// this adapter
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
/// <include file='doc\ChtmlPageAdapter.uex' path='docs/doc[@for="ChtmlPageAdapter.DeviceQualifies"]/*' />
|
||||
public new static bool DeviceQualifies(HttpContext context)
|
||||
{
|
||||
String type = ((MobileCapabilities)context.Request.Browser).PreferredRenderingType;
|
||||
bool javascriptSupported = context.Request.Browser.JavaScript;
|
||||
bool qualifies = (type == MobileCapabilities.PreferredRenderingTypeHtml32 ||
|
||||
type == MobileCapabilities.PreferredRenderingTypeChtml10)
|
||||
&& !javascriptSupported;
|
||||
return qualifies;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
// IControlAdapter implementation
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
/// <include file='doc\ChtmlPageAdapter.uex' path='docs/doc[@for="ChtmlPageAdapter.RenderPostBackEvent"]/*' />
|
||||
public override void RenderPostBackEvent(HtmlMobileTextWriter writer,
|
||||
String target,
|
||||
String argument)
|
||||
{
|
||||
// Since it doesn't have scripts, the CHTML adapter
|
||||
// only supports URL postback events.
|
||||
|
||||
RenderUrlPostBackEvent(writer, target, argument);
|
||||
}
|
||||
|
||||
/// <include file='doc\ChtmlPageAdapter.uex' path='docs/doc[@for="ChtmlPageAdapter.EventSourceKey"]/*' />
|
||||
protected override String EventSourceKey
|
||||
{
|
||||
get
|
||||
{
|
||||
return Constants.EventSourceID;
|
||||
}
|
||||
}
|
||||
|
||||
/// <include file='doc\ChtmlPageAdapter.uex' path='docs/doc[@for="ChtmlPageAdapter.EventArgumentKey"]/*' />
|
||||
protected override String EventArgumentKey
|
||||
{
|
||||
get
|
||||
{
|
||||
return Constants.EventArgumentID;
|
||||
}
|
||||
}
|
||||
|
||||
/// <include file='doc\ChtmlPageAdapter.uex' path='docs/doc[@for="ChtmlPageAdapter.RenderPostBackHeader"]/*' />
|
||||
public override void RenderPostBackHeader(HtmlMobileTextWriter writer, Form form)
|
||||
{
|
||||
bool postBack = form.Action.Length == 0;
|
||||
|
||||
RenderPageState(writer);
|
||||
if (!postBack)
|
||||
{
|
||||
writer.WriteHiddenField(EventSourceKey, _postedFromOtherFile);
|
||||
}
|
||||
else if (Page.ClientViewState == null)
|
||||
{
|
||||
// The empty event source variable is used to identify a
|
||||
// postback request
|
||||
writer.WriteHiddenField(EventSourceKey, String.Empty);
|
||||
}
|
||||
|
||||
RenderHiddenVariables(writer);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
// IPageAdapter implementation
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ==================================================================
|
||||
// For browser that doesn't support javascript, like cHTML browser,
|
||||
// control id and its corresponding value are specially encoded in
|
||||
// the post back data collection. This method is to extract the
|
||||
// encoded info and put the info back to the collection in an
|
||||
// expected format that is understood by ASP.NET Frameworks so post
|
||||
// back event is raised correctly.
|
||||
// Note other control adapters should do the encoding accordinly so
|
||||
// the data can be decoded properly here.
|
||||
//
|
||||
/// <include file='doc\ChtmlPageAdapter.uex' path='docs/doc[@for="ChtmlPageAdapter.DeterminePostBackMode"]/*' />
|
||||
public override NameValueCollection DeterminePostBackMode
|
||||
(
|
||||
HttpRequest request,
|
||||
String postEventSourceID,
|
||||
String postEventArgumentID,
|
||||
NameValueCollection baseCollection
|
||||
)
|
||||
{
|
||||
if (baseCollection != null && baseCollection[EventSourceKey] == _postedFromOtherFile)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else if (request == null)
|
||||
{
|
||||
return baseCollection;
|
||||
}
|
||||
else if (String.Compare(request.HttpMethod, "POST", StringComparison.OrdinalIgnoreCase) == 0)
|
||||
{
|
||||
return CollectionFromForm(request.Form,
|
||||
postEventSourceID,
|
||||
postEventArgumentID);
|
||||
}
|
||||
else if (request.QueryString.Count == 0)
|
||||
{
|
||||
return baseCollection;
|
||||
}
|
||||
else
|
||||
{
|
||||
return CollectionFromQueryString(request.QueryString,
|
||||
postEventSourceID,
|
||||
postEventArgumentID);
|
||||
}
|
||||
}
|
||||
|
||||
/// <include file='doc\ChtmlPageAdapter.uex' path='docs/doc[@for="ChtmlPageAdapter.CreateTextWriter"]/*' />
|
||||
public override HtmlTextWriter CreateTextWriter(TextWriter writer)
|
||||
{
|
||||
return new ChtmlMobileTextWriter(writer, Device);
|
||||
}
|
||||
|
||||
private NameValueCollection CollectionFromQueryString(
|
||||
NameValueCollection queryString,
|
||||
String postEventSourceID,
|
||||
String postEventArgumentID)
|
||||
{
|
||||
NameValueCollection collection = new NameValueCollection();
|
||||
bool isPostBack = false;
|
||||
|
||||
for (int i = 0; i < queryString.Count; i++)
|
||||
{
|
||||
String name = queryString.GetKey(i);
|
||||
|
||||
// Supposingly, we should double check if the control id
|
||||
// is real or not by checking against the control tree.
|
||||
// However, the tree can't be checked because it hasn't
|
||||
// been built at this stage. And this is the only place
|
||||
// we can override the value collection. We just need to
|
||||
// assume the control adapters are setting the id and
|
||||
// value accordingly.
|
||||
|
||||
// ASSUMPTION: In query string, besides the expected
|
||||
// name/value pairs (ViewStateID, EventSource and
|
||||
// EventArgument), there are hidden variables, control
|
||||
// id/value pairs (if the form submit method is GET), unique
|
||||
// file path suffix variable and custom query string text.
|
||||
// They will be in the above order if any of them present.
|
||||
// Hidden variables and control id/value pairs should be added
|
||||
// back to the collection intactly, but the other 2 items
|
||||
// should not be added to the collection.
|
||||
|
||||
// name can be null if there is a query name without equal
|
||||
// sign appended. We should just ignored it in this case.
|
||||
if (name == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (name == MobilePage.ViewStateID)
|
||||
{
|
||||
collection.Add(MobilePage.ViewStateID, queryString.Get(i));
|
||||
isPostBack = true;
|
||||
}
|
||||
else if (name == Constants.EventSourceID)
|
||||
{
|
||||
collection.Add(postEventSourceID, queryString.Get(i));
|
||||
isPostBack = true;
|
||||
}
|
||||
else if (name == Constants.EventArgumentID)
|
||||
{
|
||||
collection.Add(postEventArgumentID, queryString.Get(i));
|
||||
}
|
||||
else if (Constants.UniqueFilePathSuffixVariable.StartsWith(name, StringComparison.Ordinal))
|
||||
{
|
||||
// At this point we know that the rest of them is
|
||||
// the custom query string text, so we are done.
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
AddValues(queryString, name, collection);
|
||||
}
|
||||
}
|
||||
|
||||
if (collection.Count == 0 || !isPostBack)
|
||||
{
|
||||
// Returning null to indicate this is not a postback
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
return collection;
|
||||
}
|
||||
}
|
||||
|
||||
// ==================================================================
|
||||
// The complexity (multiple if statements) of this method is due to
|
||||
// workarounds for different targeted devices and limitation on non-
|
||||
// javascript html browser.
|
||||
//
|
||||
private NameValueCollection CollectionFromForm(
|
||||
NameValueCollection form,
|
||||
String postEventSourceID,
|
||||
String postEventArgumentID)
|
||||
{
|
||||
int i;
|
||||
int count = form.Count;
|
||||
NameValueCollection collection = new NameValueCollection();
|
||||
bool isPostBack = false;
|
||||
|
||||
// continue statements are used below to simplify the logic and
|
||||
// make people easier to follow and maintain the code.
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
String name = form.GetKey(i);
|
||||
|
||||
// 1. Some browser returns the name of a password textbox
|
||||
// only without the expected character "=" if the textbox is
|
||||
// empty. This causes the key to be null and the name to be
|
||||
// the value of the collection item when the returned form
|
||||
// content is parsed in HttpValueCollection. In this case,
|
||||
// we need to reverse the setting with the value as the name
|
||||
// and empty string as the value so subsequent manipulations
|
||||
// of the collection work correctly.
|
||||
if (name == null)
|
||||
{
|
||||
if (AddEmptyStringValues(form.GetValues(i), collection)) {
|
||||
isPostBack = true;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// 2. Pager navigation is rendered by buttons which have the
|
||||
// targeted page number appended to the form id after
|
||||
// PagePrefix which is a constant string to identify this
|
||||
// special case. E.g. ControlID__PG_2
|
||||
int index = name.LastIndexOf(Constants.PagePrefix, StringComparison.Ordinal);
|
||||
if (index != -1)
|
||||
{
|
||||
// We need to associate the form id with the event source
|
||||
// id and the page number with the event argument id in
|
||||
// order to have the event raised properly by ASP.NET
|
||||
int pageBeginPos = index + Constants.PagePrefix.Length;
|
||||
collection.Add(postEventSourceID,
|
||||
name.Substring(0, index));
|
||||
collection.Add(postEventArgumentID,
|
||||
name.Substring(pageBeginPos,
|
||||
name.Length - pageBeginPos));
|
||||
continue;
|
||||
}
|
||||
|
||||
// 3. This special case happens when A. SelectionList control is
|
||||
// with property SelectType equal to CheckBox or
|
||||
// MultiSelectListBox, and the device itself doesn't handle
|
||||
// multiple check boxes correctly. or B. Browser requires the
|
||||
// ID of the input element to be unique during postbacks.
|
||||
//
|
||||
// In this case, the control (SelectionList or TextBox) adapter
|
||||
// appended special characters as a suffix of the actual control
|
||||
// id. That should be stripped off when detected.
|
||||
if (Device.RequiresUniqueHtmlCheckboxNames ||
|
||||
Device.RequiresUniqueHtmlInputNames)
|
||||
{
|
||||
index = name.LastIndexOf(
|
||||
Constants.SelectionListSpecialCharacter);
|
||||
|
||||
if (index != -1)
|
||||
{
|
||||
String value = form.Get(i);
|
||||
if (!String.IsNullOrEmpty(value))
|
||||
{
|
||||
if(Device.RequiresAttributeColonSubstitution)
|
||||
{
|
||||
collection.Add(name.Substring(0, index).Replace(',',':'), value);
|
||||
}
|
||||
else
|
||||
{
|
||||
collection.Add(name.Substring(0, index), value);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 4. This is to determine if the request is a postback from
|
||||
// the same mobile page.
|
||||
if (name == MobilePage.ViewStateID ||
|
||||
name == EventSourceKey)
|
||||
{
|
||||
isPostBack = true;
|
||||
}
|
||||
|
||||
// Default case, just preserve the value(s)
|
||||
AddValues(form, name, collection);
|
||||
}
|
||||
|
||||
if (collection.Count == 0 || !isPostBack)
|
||||
{
|
||||
// Returning null to indicate this is not a postback
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
return collection;
|
||||
}
|
||||
}
|
||||
|
||||
// Helper function to add empty string as value for the keys
|
||||
private bool AddEmptyStringValues(String [] keys,
|
||||
NameValueCollection targetCollection)
|
||||
{
|
||||
bool result = false;
|
||||
foreach (String key in keys)
|
||||
{
|
||||
if (key == MobilePage.ViewStateID ||
|
||||
key == EventSourceKey) {
|
||||
result = true;
|
||||
}
|
||||
targetCollection.Add(key, String.Empty);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// Helper function to add multiple values for the same key
|
||||
private void AddValues(NameValueCollection sourceCollection,
|
||||
String sourceKey,
|
||||
NameValueCollection targetCollection)
|
||||
{
|
||||
String [] values = sourceCollection.GetValues(sourceKey);
|
||||
foreach (String value in values)
|
||||
{
|
||||
if(Device.RequiresAttributeColonSubstitution)
|
||||
{
|
||||
targetCollection.Add(sourceKey.Replace(',',':'), value);
|
||||
}
|
||||
else
|
||||
{
|
||||
targetCollection.Add(sourceKey, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,32 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <copyright file="ChtmlPhoneCallAdapter.cs" company="Microsoft">
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System.Security.Permissions;
|
||||
|
||||
#if COMPILING_FOR_SHIPPED_SOURCE
|
||||
namespace System.Web.UI.MobileControls.ShippedAdapterSource
|
||||
#else
|
||||
namespace System.Web.UI.MobileControls.Adapters
|
||||
#endif
|
||||
|
||||
{
|
||||
/*
|
||||
* ChtmlPhoneCallAdapter class.
|
||||
*/
|
||||
/// <include file='doc\ChtmlPhoneCallAdapter.uex' path='docs/doc[@for="ChtmlPhoneCallAdapter"]/*' />
|
||||
[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 ChtmlPhoneCallAdapter : HtmlPhoneCallAdapter
|
||||
{
|
||||
/// <include file='doc\ChtmlPhoneCallAdapter.uex' path='docs/doc[@for="ChtmlPhoneCallAdapter.AddAttributes"]/*' />
|
||||
protected override void AddAttributes(HtmlMobileTextWriter writer)
|
||||
{
|
||||
AddAccesskeyAttribute(writer);
|
||||
AddJPhoneMultiMediaAttributes(writer);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,116 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <copyright file="ChtmlSelectionListAdapter.cs" company="Microsoft">
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.HtmlControls;
|
||||
using System.Web.UI.MobileControls;
|
||||
using System.Security.Permissions;
|
||||
|
||||
#if COMPILING_FOR_SHIPPED_SOURCE
|
||||
namespace System.Web.UI.MobileControls.ShippedAdapterSource
|
||||
#else
|
||||
namespace System.Web.UI.MobileControls.Adapters
|
||||
#endif
|
||||
|
||||
{
|
||||
/*
|
||||
* ChtmlSelectionListAdapter provides the chtml device functionality for SelectionList controls.
|
||||
*
|
||||
* Copyright (c) 2000 Microsoft Corporation
|
||||
*/
|
||||
/// <include file='doc\ChtmlSelectionListAdapter.uex' path='docs/doc[@for="ChtmlSelectionListAdapter"]/*' />
|
||||
[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 ChtmlSelectionListAdapter : HtmlSelectionListAdapter
|
||||
{
|
||||
/// <include file='doc\ChtmlSelectionListAdapter.uex' path='docs/doc[@for="ChtmlSelectionListAdapter.RequiresFormTag"]/*' />
|
||||
public override bool RequiresFormTag
|
||||
{
|
||||
get
|
||||
{
|
||||
// Some browsers require the form tag to display the selection
|
||||
// list properly
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <include file='doc\ChtmlSelectionListAdapter.uex' path='docs/doc[@for="ChtmlSelectionListAdapter.Render"]/*' />
|
||||
public override void Render(HtmlMobileTextWriter writer)
|
||||
{
|
||||
ListSelectType selectType = Control.SelectType;
|
||||
if (selectType == ListSelectType.MultiSelectListBox &&
|
||||
Device.SupportsSelectMultiple == false)
|
||||
{
|
||||
// Render occurs after SaveViewState. Here we make a temp
|
||||
// change which is not persisted to the view state.
|
||||
Control.SelectType = selectType = ListSelectType.CheckBox;
|
||||
}
|
||||
|
||||
if (!Device.RequiresUniqueHtmlCheckboxNames ||
|
||||
selectType != ListSelectType.CheckBox)
|
||||
{
|
||||
base.Render(writer);
|
||||
}
|
||||
else
|
||||
{
|
||||
MobileListItemCollection items = Control.Items;
|
||||
if (items.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
writer.EnterStyle(Style);
|
||||
bool writeBreak = false;
|
||||
foreach (MobileListItem item in items)
|
||||
{
|
||||
int index = items.IndexOf(item);
|
||||
if(writeBreak)
|
||||
{
|
||||
writer.WriteBreak();
|
||||
}
|
||||
|
||||
writer.Write("<input type=\"checkbox\" name=\"");
|
||||
if(Device.RequiresAttributeColonSubstitution)
|
||||
{
|
||||
writer.Write(Control.UniqueID.Replace(':', ','));
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.Write(Control.UniqueID);
|
||||
}
|
||||
writer.Write(Constants.SelectionListSpecialCharacter);
|
||||
writer.Write(index);
|
||||
writer.Write("\" value=\"");
|
||||
if (!String.IsNullOrEmpty(Control.Form.Action))
|
||||
{
|
||||
writer.WriteEncodedText(item.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.Write(item.Index.ToString(CultureInfo.InvariantCulture));
|
||||
}
|
||||
if (item.Selected &&
|
||||
Device.SupportsUncheck)
|
||||
{
|
||||
writer.Write("\" checked>");
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.Write("\">");
|
||||
}
|
||||
|
||||
writer.WriteText(item.Text, true);
|
||||
writeBreak = true;
|
||||
}
|
||||
writer.ExitStyle(Style, Control.BreakAfter);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,88 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <copyright file="ChtmlTextBoxAdapter.cs" company="Microsoft">
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System.Security.Permissions;
|
||||
|
||||
#if COMPILING_FOR_SHIPPED_SOURCE
|
||||
namespace System.Web.UI.MobileControls.ShippedAdapterSource
|
||||
#else
|
||||
namespace System.Web.UI.MobileControls.Adapters
|
||||
#endif
|
||||
|
||||
{
|
||||
/*
|
||||
* ChtmlTextBoxAdapter class.
|
||||
*
|
||||
* Copyright (c) 2000 Microsoft Corporation
|
||||
*/
|
||||
/// <include file='doc\ChtmlTextBoxAdapter.uex' path='docs/doc[@for="ChtmlTextBoxAdapter"]/*' />
|
||||
[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 ChtmlTextBoxAdapter : HtmlTextBoxAdapter
|
||||
{
|
||||
private static Random _random = new Random();
|
||||
|
||||
/// <include file='doc\ChtmlTextBoxAdapter.uex' path='docs/doc[@for="ChtmlTextBoxAdapter.AddAttributes"]/*' />
|
||||
protected override void AddAttributes(HtmlMobileTextWriter writer)
|
||||
{
|
||||
if (Control.Numeric)
|
||||
{
|
||||
if (Device.SupportsInputIStyle)
|
||||
{
|
||||
// The default input mode is always numeric if the
|
||||
// type is password.
|
||||
if (!Control.Password)
|
||||
{
|
||||
writer.WriteAttribute("istyle", "4");
|
||||
}
|
||||
}
|
||||
else if (Device.SupportsInputMode)
|
||||
{
|
||||
writer.WriteAttribute("mode", "numeric");
|
||||
}
|
||||
}
|
||||
|
||||
AddAccesskeyAttribute(writer);
|
||||
AddJPhoneMultiMediaAttributes(writer);
|
||||
}
|
||||
|
||||
/// <include file='doc\ChtmlTextBoxAdapter.uex' path='docs/doc[@for="ChtmlTextBoxAdapter.RequiresFormTag"]/*' />
|
||||
public override bool RequiresFormTag
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private String GetRandomID(int length)
|
||||
{
|
||||
Byte[] randomBytes = new Byte[length];
|
||||
_random.NextBytes(randomBytes);
|
||||
|
||||
char[] randomChars = new char[length];
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
randomChars[i] = (char)((((int)randomBytes[i]) % 26) + 'a');
|
||||
}
|
||||
|
||||
return new String(randomChars);
|
||||
}
|
||||
|
||||
internal override String GetRenderName()
|
||||
{
|
||||
String renderName = base.GetRenderName();
|
||||
|
||||
if (Device.RequiresUniqueHtmlInputNames)
|
||||
{
|
||||
renderName += Constants.SelectionListSpecialCharacter + GetRandomID(4);
|
||||
}
|
||||
|
||||
return renderName;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,307 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <copyright file="ControlAdapter.cs" company="Microsoft">
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.HtmlControls;
|
||||
using System.Web.Mobile;
|
||||
using RootMobile = System.Web.Mobile;
|
||||
using System.Web.UI.MobileControls;
|
||||
using System.Collections;
|
||||
using System.Collections.Specialized;
|
||||
using System.Text;
|
||||
using System.Security.Permissions;
|
||||
|
||||
// We don't recompile this base class in the shipped source samples, as it
|
||||
// accesses some internal functionality and is a core utility (rather than an
|
||||
// extension itself).
|
||||
#if !COMPILING_FOR_SHIPPED_SOURCE
|
||||
|
||||
namespace System.Web.UI.MobileControls.Adapters
|
||||
{
|
||||
|
||||
/*
|
||||
* ControlAdapter base class.
|
||||
*
|
||||
* Copyright (c) 2000 Microsoft Corporation
|
||||
*/
|
||||
/// <include file='doc\ControlAdapter.uex' path='docs/doc[@for="ControlAdapter"]/*' />
|
||||
[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 abstract class ControlAdapter : IControlAdapter
|
||||
{
|
||||
private static readonly String[] LabelIDs = new String[] {
|
||||
RootMobile.SR.ControlAdapter_BackLabel,
|
||||
RootMobile.SR.ControlAdapter_GoLabel,
|
||||
RootMobile.SR.ControlAdapter_OKLabel,
|
||||
RootMobile.SR.ControlAdapter_MoreLabel,
|
||||
RootMobile.SR.ControlAdapter_OptionsLabel,
|
||||
RootMobile.SR.ControlAdapter_NextLabel,
|
||||
RootMobile.SR.ControlAdapter_PreviousLabel,
|
||||
RootMobile.SR.ControlAdapter_LinkLabel,
|
||||
RootMobile.SR.ControlAdapter_PhoneCallLabel
|
||||
};
|
||||
|
||||
/// <include file='doc\ControlAdapter.uex' path='docs/doc[@for="ControlAdapter.BackLabel"]/*' />
|
||||
protected static readonly int BackLabel = 0;
|
||||
/// <include file='doc\ControlAdapter.uex' path='docs/doc[@for="ControlAdapter.GoLabel"]/*' />
|
||||
protected static readonly int GoLabel = 1;
|
||||
/// <include file='doc\ControlAdapter.uex' path='docs/doc[@for="ControlAdapter.OKLabel"]/*' />
|
||||
protected static readonly int OKLabel = 2;
|
||||
/// <include file='doc\ControlAdapter.uex' path='docs/doc[@for="ControlAdapter.MoreLabel"]/*' />
|
||||
protected static readonly int MoreLabel = 3;
|
||||
/// <include file='doc\ControlAdapter.uex' path='docs/doc[@for="ControlAdapter.OptionsLabel"]/*' />
|
||||
protected static readonly int OptionsLabel = 4;
|
||||
/// <include file='doc\ControlAdapter.uex' path='docs/doc[@for="ControlAdapter.NextLabel"]/*' />
|
||||
protected static readonly int NextLabel = 5;
|
||||
/// <include file='doc\ControlAdapter.uex' path='docs/doc[@for="ControlAdapter.PreviousLabel"]/*' />
|
||||
protected static readonly int PreviousLabel = 6;
|
||||
/// <include file='doc\ControlAdapter.uex' path='docs/doc[@for="ControlAdapter.LinkLabel"]/*' />
|
||||
protected static readonly int LinkLabel = 7;
|
||||
/// <include file='doc\ControlAdapter.uex' path='docs/doc[@for="ControlAdapter.CallLabel"]/*' />
|
||||
protected static readonly int CallLabel = 8;
|
||||
|
||||
private MobileControl _control;
|
||||
|
||||
/// <include file='doc\ControlAdapter.uex' path='docs/doc[@for="ControlAdapter.Control"]/*' />
|
||||
public MobileControl Control
|
||||
{
|
||||
get
|
||||
{
|
||||
return _control;
|
||||
}
|
||||
set
|
||||
{
|
||||
_control = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <include file='doc\ControlAdapter.uex' path='docs/doc[@for="ControlAdapter.Page"]/*' />
|
||||
public virtual MobilePage Page
|
||||
{
|
||||
get
|
||||
{
|
||||
return Control.MobilePage;
|
||||
}
|
||||
set
|
||||
{
|
||||
// Do not expect to be called directly. Subclasses should
|
||||
// override this when needed.
|
||||
throw new Exception(
|
||||
SR.GetString(
|
||||
SR.ControlAdapterBasePagePropertyShouldNotBeSet));
|
||||
}
|
||||
}
|
||||
|
||||
/// <include file='doc\ControlAdapter.uex' path='docs/doc[@for="ControlAdapter.Device"]/*' />
|
||||
public virtual MobileCapabilities Device
|
||||
{
|
||||
get
|
||||
{
|
||||
return (MobileCapabilities)Page.Request.Browser;
|
||||
}
|
||||
}
|
||||
|
||||
/// <include file='doc\ControlAdapter.uex' path='docs/doc[@for="ControlAdapter.OnInit"]/*' />
|
||||
public virtual void OnInit(EventArgs e){}
|
||||
/// <include file='doc\ControlAdapter.uex' path='docs/doc[@for="ControlAdapter.OnLoad"]/*' />
|
||||
public virtual void OnLoad(EventArgs e){}
|
||||
/// <include file='doc\ControlAdapter.uex' path='docs/doc[@for="ControlAdapter.OnPreRender"]/*' />
|
||||
public virtual void OnPreRender(EventArgs e){}
|
||||
|
||||
/// <include file='doc\ControlAdapter.uex' path='docs/doc[@for="ControlAdapter.Render"]/*' />
|
||||
public virtual void Render(HtmlTextWriter writer)
|
||||
{
|
||||
RenderChildren(writer);
|
||||
}
|
||||
|
||||
/// <include file='doc\ControlAdapter.uex' path='docs/doc[@for="ControlAdapter.OnUnload"]/*' />
|
||||
public virtual void OnUnload(EventArgs e){}
|
||||
|
||||
/// <include file='doc\ControlAdapter.uex' path='docs/doc[@for="ControlAdapter.HandlePostBackEvent"]/*' />
|
||||
public virtual bool HandlePostBackEvent(String eventArgument)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// By default, always return false, so the control itself will handle
|
||||
// it.
|
||||
/// <include file='doc\ControlAdapter.uex' path='docs/doc[@for="ControlAdapter.LoadPostData"]/*' />
|
||||
public virtual bool LoadPostData(String key,
|
||||
NameValueCollection data,
|
||||
Object controlPrivateData,
|
||||
out bool dataChanged)
|
||||
{
|
||||
dataChanged = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <include file='doc\ControlAdapter.uex' path='docs/doc[@for="ControlAdapter.LoadAdapterState"]/*' />
|
||||
public virtual void LoadAdapterState(Object state)
|
||||
{
|
||||
}
|
||||
|
||||
/// <include file='doc\ControlAdapter.uex' path='docs/doc[@for="ControlAdapter.SaveAdapterState"]/*' />
|
||||
public virtual Object SaveAdapterState()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <include file='doc\ControlAdapter.uex' path='docs/doc[@for="ControlAdapter.CreateTemplatedUI"]/*' />
|
||||
public virtual void CreateTemplatedUI(bool doDataBind)
|
||||
{
|
||||
// No device specific templated UI to create.
|
||||
|
||||
Control.CreateDefaultTemplatedUI(doDataBind);
|
||||
}
|
||||
|
||||
// convenience methods here
|
||||
/// <include file='doc\ControlAdapter.uex' path='docs/doc[@for="ControlAdapter.Style"]/*' />
|
||||
public Style Style
|
||||
{
|
||||
get
|
||||
{
|
||||
return Control.Style;
|
||||
}
|
||||
}
|
||||
|
||||
/// <include file='doc\ControlAdapter.uex' path='docs/doc[@for="ControlAdapter.RenderChildren"]/*' />
|
||||
protected void RenderChildren(HtmlTextWriter writer)
|
||||
{
|
||||
if (Control.HasControls())
|
||||
{
|
||||
foreach (Control child in Control.Controls)
|
||||
{
|
||||
child.RenderControl(writer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <include file='doc\ControlAdapter.uex' path='docs/doc[@for="ControlAdapter.VisibleWeight"]/*' />
|
||||
public virtual int VisibleWeight
|
||||
{
|
||||
get
|
||||
{
|
||||
return ControlPager.UseDefaultWeight;
|
||||
}
|
||||
}
|
||||
|
||||
/// <include file='doc\ControlAdapter.uex' path='docs/doc[@for="ControlAdapter.ItemWeight"]/*' />
|
||||
public virtual int ItemWeight
|
||||
{
|
||||
get
|
||||
{
|
||||
return ControlPager.UseDefaultWeight;
|
||||
}
|
||||
}
|
||||
|
||||
// The following method is used by PageAdapter subclasses of
|
||||
// ControlAdapter for determining the optimum page weight for
|
||||
// a given device. Algorithm is as follows:
|
||||
// 1) First look for the "optimumPageWeight" parameter set
|
||||
// for the device. If it exists, and can be converted
|
||||
// to an integer, use it.
|
||||
// 2) Otherwise, look for the "screenCharactersHeight" parameter.
|
||||
// If it exists, and can be converted to an integer, multiply
|
||||
// it by 100 and use the result.
|
||||
// 3) As a last resort, use the default provided by the calling
|
||||
// PageAdapter.
|
||||
/// <include file='doc\ControlAdapter.uex' path='docs/doc[@for="ControlAdapter.CalculateOptimumPageWeight"]/*' />
|
||||
protected virtual int CalculateOptimumPageWeight(int defaultPageWeight)
|
||||
{
|
||||
int optimumPageWeight = 0;
|
||||
|
||||
// Pull OptimumPageWeight from the web.config parameter of the same
|
||||
// name, when present.
|
||||
String pageWeight = Device[Constants.OptimumPageWeightParameter];
|
||||
|
||||
if (pageWeight != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
optimumPageWeight = Convert.ToInt32(pageWeight, CultureInfo.InvariantCulture);
|
||||
}
|
||||
catch
|
||||
{
|
||||
optimumPageWeight = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (optimumPageWeight <= 0)
|
||||
{
|
||||
// If OptimumPageWeight isn't established explicitly, attempt to
|
||||
// construct it as 100 * number of lines of characters.
|
||||
String numLinesStr = Device[Constants.ScreenCharactersHeightParameter];
|
||||
if (numLinesStr != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
int numLines = Convert.ToInt32(numLinesStr, CultureInfo.InvariantCulture);
|
||||
optimumPageWeight = 100 * numLines;
|
||||
}
|
||||
catch
|
||||
{
|
||||
optimumPageWeight = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (optimumPageWeight <= 0)
|
||||
{
|
||||
optimumPageWeight = defaultPageWeight;
|
||||
}
|
||||
|
||||
return optimumPageWeight;
|
||||
}
|
||||
|
||||
private String[] _defaultLabels = null;
|
||||
|
||||
/// <include file='doc\ControlAdapter.uex' path='docs/doc[@for="ControlAdapter.GetDefaultLabel"]/*' />
|
||||
protected String GetDefaultLabel(int labelID)
|
||||
{
|
||||
if ((labelID < 0) || (labelID >= LabelIDs.Length))
|
||||
{
|
||||
throw new ArgumentException(System.Web.Mobile.SR.GetString(
|
||||
System.Web.Mobile.SR.ControlAdapter_InvalidDefaultLabel));
|
||||
}
|
||||
|
||||
MobilePage page = Page;
|
||||
if (page != null)
|
||||
{
|
||||
ControlAdapter pageAdapter = (ControlAdapter)page.Adapter;
|
||||
if (pageAdapter._defaultLabels == null)
|
||||
{
|
||||
pageAdapter._defaultLabels = new String[LabelIDs.Length];
|
||||
}
|
||||
|
||||
String labelValue = pageAdapter._defaultLabels[labelID];
|
||||
if (labelValue == null)
|
||||
{
|
||||
labelValue = System.Web.Mobile.SR.GetString(LabelIDs[labelID]);
|
||||
pageAdapter._defaultLabels[labelID] = labelValue;
|
||||
}
|
||||
|
||||
return labelValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
return System.Web.Mobile.SR.GetString(LabelIDs[labelID]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[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.")]
|
||||
internal class EmptyControlAdapter : ControlAdapter {
|
||||
internal EmptyControlAdapter() {}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@@ -0,0 +1,383 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <copyright file="EmptyTextWriter.cs" company="Microsoft">
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Collections;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Web.Mobile;
|
||||
using System.Web.UI.MobileControls;
|
||||
|
||||
#if COMPILING_FOR_SHIPPED_SOURCE
|
||||
namespace System.Web.UI.MobileControls.ShippedAdapterSource
|
||||
#else
|
||||
namespace System.Web.UI.MobileControls.Adapters
|
||||
#endif
|
||||
|
||||
{
|
||||
/*
|
||||
* EmptyTextWriter class. Like the Null text writer, but keeps track of whether
|
||||
* anything was written or not.
|
||||
*
|
||||
* Copyright (c) 2000 Microsoft Corporation
|
||||
*/
|
||||
|
||||
[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.")]
|
||||
internal class EmptyTextWriter : TextWriter
|
||||
{
|
||||
#if UNUSED_CODE
|
||||
bool _writeCalled = false;
|
||||
#endif
|
||||
bool _nonWhiteSpaceWritten = false;
|
||||
|
||||
internal EmptyTextWriter() : base(CultureInfo.CurrentCulture)
|
||||
{
|
||||
}
|
||||
|
||||
#if UNUSED_CODE
|
||||
internal /*public*/ bool WriteCalled
|
||||
{
|
||||
get
|
||||
{
|
||||
return _writeCalled;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
internal /*public*/ bool NonWhiteSpaceWritten
|
||||
{
|
||||
get
|
||||
{
|
||||
return _nonWhiteSpaceWritten;
|
||||
}
|
||||
}
|
||||
|
||||
internal /*public*/ void Reset()
|
||||
{
|
||||
#if UNUSED_CODE
|
||||
_writeCalled = false;
|
||||
#endif
|
||||
_nonWhiteSpaceWritten = false;
|
||||
}
|
||||
|
||||
public override void Write(string s)
|
||||
{
|
||||
#if UNUSED_CODE
|
||||
_writeCalled = true;
|
||||
#endif
|
||||
if (!IsWhiteSpace(s))
|
||||
{
|
||||
_nonWhiteSpaceWritten = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Write(bool value)
|
||||
{
|
||||
#if UNUSED_CODE
|
||||
_writeCalled = true;
|
||||
#endif
|
||||
_nonWhiteSpaceWritten = true;
|
||||
}
|
||||
|
||||
public override void Write(char value)
|
||||
{
|
||||
#if UNUSED_CODE
|
||||
_writeCalled = true;
|
||||
#endif
|
||||
_nonWhiteSpaceWritten = true;
|
||||
}
|
||||
|
||||
public override void Write(char[] buffer)
|
||||
{
|
||||
#if UNUSED_CODE
|
||||
_writeCalled = true;
|
||||
#endif
|
||||
if (!IsWhiteSpace(buffer))
|
||||
{
|
||||
_nonWhiteSpaceWritten = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Write(char[] buffer, int index, int count)
|
||||
{
|
||||
#if UNUSED_CODE
|
||||
_writeCalled = true;
|
||||
#endif
|
||||
if (!IsWhiteSpace(buffer, index, count))
|
||||
{
|
||||
_nonWhiteSpaceWritten = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Write(double value)
|
||||
{
|
||||
#if UNUSED_CODE
|
||||
_writeCalled = true;
|
||||
#endif
|
||||
_nonWhiteSpaceWritten = true;
|
||||
}
|
||||
|
||||
public override void Write(float value)
|
||||
{
|
||||
#if UNUSED_CODE
|
||||
_writeCalled = true;
|
||||
#endif
|
||||
_nonWhiteSpaceWritten = true;
|
||||
}
|
||||
|
||||
public override void Write(int value)
|
||||
{
|
||||
#if UNUSED_CODE
|
||||
_writeCalled = true;
|
||||
#endif
|
||||
_nonWhiteSpaceWritten = true;
|
||||
}
|
||||
|
||||
public override void Write(long value)
|
||||
{
|
||||
#if UNUSED_CODE
|
||||
_writeCalled = true;
|
||||
#endif
|
||||
_nonWhiteSpaceWritten = true;
|
||||
}
|
||||
|
||||
public override void Write(Object value)
|
||||
{
|
||||
#if UNUSED_CODE
|
||||
_writeCalled = true;
|
||||
#endif
|
||||
if (value != null && !IsWhiteSpace(value.ToString()))
|
||||
{
|
||||
_nonWhiteSpaceWritten = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Write(String format, Object arg0)
|
||||
{
|
||||
#if UNUSED_CODE
|
||||
_writeCalled = true;
|
||||
#endif
|
||||
if (!IsWhiteSpace(format) && !IsWhiteSpace(String.Format(CultureInfo.CurrentCulture, format, arg0)))
|
||||
{
|
||||
_nonWhiteSpaceWritten = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Write(String format, Object arg0, Object arg1)
|
||||
{
|
||||
#if UNUSED_CODE
|
||||
_writeCalled = true;
|
||||
#endif
|
||||
if (!IsWhiteSpace(format) && !IsWhiteSpace(String.Format(CultureInfo.CurrentCulture, format, arg0, arg1)))
|
||||
{
|
||||
_nonWhiteSpaceWritten = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Write(String format, params object[] arg)
|
||||
{
|
||||
#if UNUSED_CODE
|
||||
_writeCalled = true;
|
||||
#endif
|
||||
if (!IsWhiteSpace(format) && !IsWhiteSpace(String.Format(CultureInfo.CurrentCulture, format, arg)))
|
||||
{
|
||||
_nonWhiteSpaceWritten = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void WriteLine(string s)
|
||||
{
|
||||
#if UNUSED_CODE
|
||||
_writeCalled = true;
|
||||
#endif
|
||||
if (!IsWhiteSpace(s))
|
||||
{
|
||||
_nonWhiteSpaceWritten = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void WriteLine(bool value)
|
||||
{
|
||||
#if UNUSED_CODE
|
||||
_writeCalled = true;
|
||||
#endif
|
||||
_nonWhiteSpaceWritten = true;
|
||||
}
|
||||
|
||||
public override void WriteLine(char value)
|
||||
{
|
||||
#if UNUSED_CODE
|
||||
_writeCalled = true;
|
||||
#endif
|
||||
_nonWhiteSpaceWritten = true;
|
||||
}
|
||||
|
||||
public override void WriteLine(char[] buffer)
|
||||
{
|
||||
#if UNUSED_CODE
|
||||
_writeCalled = true;
|
||||
#endif
|
||||
if (!IsWhiteSpace(buffer))
|
||||
{
|
||||
_nonWhiteSpaceWritten = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void WriteLine(char[] buffer, int index, int count)
|
||||
{
|
||||
#if UNUSED_CODE
|
||||
_writeCalled = true;
|
||||
#endif
|
||||
if (!IsWhiteSpace(buffer, index, count))
|
||||
{
|
||||
_nonWhiteSpaceWritten = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void WriteLine(double value)
|
||||
{
|
||||
#if UNUSED_CODE
|
||||
_writeCalled = true;
|
||||
#endif
|
||||
_nonWhiteSpaceWritten = true;
|
||||
}
|
||||
|
||||
public override void WriteLine(float value)
|
||||
{
|
||||
#if UNUSED_CODE
|
||||
_writeCalled = true;
|
||||
#endif
|
||||
_nonWhiteSpaceWritten = true;
|
||||
}
|
||||
|
||||
public override void WriteLine(int value)
|
||||
{
|
||||
#if UNUSED_CODE
|
||||
_writeCalled = true;
|
||||
#endif
|
||||
_nonWhiteSpaceWritten = true;
|
||||
}
|
||||
|
||||
public override void WriteLine(long value)
|
||||
{
|
||||
#if UNUSED_CODE
|
||||
_writeCalled = true;
|
||||
#endif
|
||||
_nonWhiteSpaceWritten = true;
|
||||
}
|
||||
|
||||
public override void WriteLine(Object value)
|
||||
{
|
||||
#if UNUSED_CODE
|
||||
_writeCalled = true;
|
||||
#endif
|
||||
if (value != null && !IsWhiteSpace(value.ToString()))
|
||||
{
|
||||
_nonWhiteSpaceWritten = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void WriteLine(String format, Object arg0)
|
||||
{
|
||||
#if UNUSED_CODE
|
||||
_writeCalled = true;
|
||||
#endif
|
||||
if (!IsWhiteSpace(format) && !IsWhiteSpace(String.Format(CultureInfo.CurrentCulture, format, arg0)))
|
||||
{
|
||||
_nonWhiteSpaceWritten = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void WriteLine(String format, Object arg0, Object arg1)
|
||||
{
|
||||
#if UNUSED_CODE
|
||||
_writeCalled = true;
|
||||
#endif
|
||||
if (!IsWhiteSpace(format) && !IsWhiteSpace(String.Format(CultureInfo.CurrentCulture, format, arg0, arg1)))
|
||||
{
|
||||
_nonWhiteSpaceWritten = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void WriteLine(String format, params object[] arg)
|
||||
{
|
||||
#if UNUSED_CODE
|
||||
_writeCalled = true;
|
||||
#endif
|
||||
if (!IsWhiteSpace(format) && !IsWhiteSpace(String.Format(CultureInfo.CurrentCulture, format, arg)))
|
||||
{
|
||||
_nonWhiteSpaceWritten = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void WriteLine(UInt32 value)
|
||||
{
|
||||
#if UNUSED_CODE
|
||||
_writeCalled = true;
|
||||
#endif
|
||||
_nonWhiteSpaceWritten = true;
|
||||
}
|
||||
|
||||
public override Encoding Encoding
|
||||
{
|
||||
get
|
||||
{
|
||||
return Encoding.UTF8;
|
||||
}
|
||||
}
|
||||
|
||||
private static bool IsWhiteSpace(String s)
|
||||
{
|
||||
if (s == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
for (int i = s.Length - 1; i >= 0; i--)
|
||||
{
|
||||
char c = s[i];
|
||||
if (c != '\r' && c != '\n' && !Char.IsWhiteSpace(c))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static bool IsWhiteSpace(char[] buffer)
|
||||
{
|
||||
if (buffer == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return IsWhiteSpace(buffer, 0, buffer.Length);
|
||||
}
|
||||
|
||||
private static bool IsWhiteSpace(char[] buffer, int index, int count)
|
||||
{
|
||||
if (buffer == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
char c = buffer[index + i];
|
||||
if (c != '\r' && c != '\n' && !Char.IsWhiteSpace(c))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,155 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <copyright file="HtmlCalendarAdapter.cs" company="Microsoft">
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Drawing;
|
||||
using System.Web.UI.MobileControls;
|
||||
using System.Security.Permissions;
|
||||
using System.Globalization;
|
||||
|
||||
#if COMPILING_FOR_SHIPPED_SOURCE
|
||||
namespace System.Web.UI.MobileControls.ShippedAdapterSource
|
||||
#else
|
||||
namespace System.Web.UI.MobileControls.Adapters
|
||||
#endif
|
||||
|
||||
{
|
||||
/*
|
||||
* HtmlCalendarAdapter provides the html device functionality for
|
||||
* Calendar control.
|
||||
*
|
||||
* Copyright (c) 2000 Microsoft Corporation
|
||||
*/
|
||||
/// <include file='doc\HtmlCalendarAdapter.uex' path='docs/doc[@for="HtmlCalendarAdapter"]/*' />
|
||||
[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 HtmlCalendarAdapter : HtmlControlAdapter
|
||||
{
|
||||
// Insert bgcolor="Silver" right after td tag
|
||||
private const int _bgColorInsertionPointInPattern = 4;
|
||||
// Defines a disk in which the color White is chosen instead of Silver
|
||||
private const int _bgColorDistanceTreshold = 1000;
|
||||
// Search patterns for locating cells of selected dates
|
||||
private const String _selectedDateSearchTableTag = "<table ";
|
||||
private const String _selectedDateSearchCellTag = "<td ";
|
||||
private const String _selectedDateSearchAttr = "background-color:Silver;";
|
||||
|
||||
/// <include file='doc\HtmlCalendarAdapter.uex' path='docs/doc[@for="HtmlCalendarAdapter.Control"]/*' />
|
||||
protected new Calendar Control
|
||||
{
|
||||
get
|
||||
{
|
||||
return (Calendar)base.Control;
|
||||
}
|
||||
}
|
||||
|
||||
private int LocateNextSelectedDate(String webCalendarHtml, int startingIndex)
|
||||
{
|
||||
int tagBeginIndex = startingIndex;
|
||||
do
|
||||
{
|
||||
tagBeginIndex = webCalendarHtml.IndexOf(_selectedDateSearchCellTag, tagBeginIndex, StringComparison.Ordinal);
|
||||
if (tagBeginIndex >= 0)
|
||||
{
|
||||
int tagEndIndex = webCalendarHtml.IndexOf(">", tagBeginIndex + _bgColorInsertionPointInPattern, StringComparison.Ordinal);
|
||||
Debug.Assert(tagEndIndex >= 0);
|
||||
String tagComplete = webCalendarHtml.Substring(tagBeginIndex, tagEndIndex-tagBeginIndex+1);
|
||||
if (tagComplete.IndexOf(_selectedDateSearchAttr, StringComparison.Ordinal) >= 0)
|
||||
{
|
||||
return tagBeginIndex;
|
||||
}
|
||||
else
|
||||
{
|
||||
tagBeginIndex += _bgColorInsertionPointInPattern;
|
||||
}
|
||||
}
|
||||
}
|
||||
while (tagBeginIndex >= 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/// <include file='doc\HtmlCalendarAdapter.uex' path='docs/doc[@for="HtmlCalendarAdapter.Render"]/*' />
|
||||
public override void Render(HtmlMobileTextWriter writer)
|
||||
{
|
||||
System.Web.UI.WebControls.WebControl webCalendar = Control.WebCalendar;
|
||||
|
||||
Style.ApplyTo(webCalendar);
|
||||
|
||||
// Delegate the rendering effort to the child Web Calendar
|
||||
// control for HTML browser
|
||||
webCalendar.Visible = true;
|
||||
|
||||
// There is no explicit property for alignment on WebForms
|
||||
// Calendar, so we need some special code to set it.
|
||||
writer.EnterLayout(Style);
|
||||
writer.EnsureStyle();
|
||||
Alignment align = (Alignment) Style[Style.AlignmentKey, true];
|
||||
if (!Device.SupportsDivAlign)
|
||||
{
|
||||
webCalendar.Attributes["align"] = align.ToString();
|
||||
}
|
||||
|
||||
if (Device.SupportsCss)
|
||||
{
|
||||
// Target device supports CSS - simply delegate the rendering
|
||||
// to the underlying Web Calendar control
|
||||
webCalendar.RenderControl(writer);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Insert bgcolor attributes in cells that correspond to selected dates
|
||||
StringWriter sw = new StringWriter(CultureInfo.InvariantCulture);
|
||||
HtmlTextWriter tmpWriter = new HtmlTextWriter(sw);
|
||||
webCalendar.RenderControl(tmpWriter);
|
||||
String webCalendarHtml = sw.ToString();
|
||||
int index = 0, indexLastTable = 0;
|
||||
// Search for offset of last <table> tag in the Web Calendar HTML.
|
||||
// That table contains the various days.
|
||||
do
|
||||
{
|
||||
index = webCalendarHtml.IndexOf(_selectedDateSearchTableTag, index, StringComparison.Ordinal);
|
||||
if (index >= 0)
|
||||
{
|
||||
indexLastTable = index;
|
||||
index += 5;
|
||||
}
|
||||
}
|
||||
while (index >= 0);
|
||||
index = LocateNextSelectedDate(webCalendarHtml, indexLastTable);
|
||||
if (index >= 0)
|
||||
{
|
||||
// Determine the background color of the containing Form control
|
||||
HtmlControlAdapter formAdapter = (HtmlControlAdapter) Control.Form.Adapter;
|
||||
Color backColor = (Color)formAdapter.Style[Style.BackColorKey, true];
|
||||
int deltaR = System.Math.Abs(backColor.R - 0xC0);
|
||||
int deltaG = System.Math.Abs(backColor.G - 0xC0);
|
||||
int deltaB = System.Math.Abs(backColor.B - 0xC0);
|
||||
// Determine the distance between Silver and the Form's background color
|
||||
int bgColorDistance = deltaR * deltaR + deltaG * deltaG + deltaB * deltaB;
|
||||
// Choose Silver or White depending on that distance
|
||||
String selectedDateBGColor =
|
||||
String.Format(CultureInfo.CurrentCulture, "bgcolor=\"{0}\" ", bgColorDistance < _bgColorDistanceTreshold ? "White" : "Silver");
|
||||
while (index >= 0)
|
||||
{
|
||||
// Insert the bgcolor attribute for each selected date cell
|
||||
webCalendarHtml = webCalendarHtml.Insert(index + _bgColorInsertionPointInPattern, selectedDateBGColor);
|
||||
index = LocateNextSelectedDate(webCalendarHtml, index + _bgColorInsertionPointInPattern);
|
||||
}
|
||||
}
|
||||
// Use the HTML after insertions
|
||||
writer.Write(webCalendarHtml);
|
||||
}
|
||||
|
||||
if(Control.BreakAfter)
|
||||
{
|
||||
writer.WriteBreak();
|
||||
}
|
||||
writer.ExitLayout(Style);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,138 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <copyright file="HtmlCommandAdapter.cs" company="Microsoft">
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Collections.Specialized;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.MobileControls;
|
||||
using System.Drawing;
|
||||
using System.Security.Permissions;
|
||||
|
||||
#if COMPILING_FOR_SHIPPED_SOURCE
|
||||
namespace System.Web.UI.MobileControls.ShippedAdapterSource
|
||||
#else
|
||||
namespace System.Web.UI.MobileControls.Adapters
|
||||
#endif
|
||||
|
||||
{
|
||||
|
||||
/*
|
||||
* HtmlCommandAdapter class.
|
||||
*
|
||||
* Copyright (c) 2000 Microsoft Corporation
|
||||
*/
|
||||
/// <include file='doc\HtmlCommandAdapter.uex' path='docs/doc[@for="HtmlCommandAdapter"]/*' />
|
||||
[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 HtmlCommandAdapter : HtmlControlAdapter
|
||||
{
|
||||
/// <include file='doc\HtmlCommandAdapter.uex' path='docs/doc[@for="HtmlCommandAdapter.Control"]/*' />
|
||||
protected new Command Control
|
||||
{
|
||||
get
|
||||
{
|
||||
return (Command)base.Control;
|
||||
}
|
||||
}
|
||||
|
||||
/// <include file='doc\HtmlCommandAdapter.uex' path='docs/doc[@for="HtmlCommandAdapter.Render"]/*' />
|
||||
public override void Render(HtmlMobileTextWriter writer)
|
||||
{
|
||||
bool renderLink = false;
|
||||
bool renderImage = false;
|
||||
|
||||
// If image is defined and renderable, just do it. Otherwise,
|
||||
// render as a link if specified.
|
||||
if (!String.IsNullOrEmpty(Control.ImageUrl) &&
|
||||
Device.SupportsImageSubmit)
|
||||
{
|
||||
renderImage = true;
|
||||
}
|
||||
else if (Control.Format == CommandFormat.Link &&
|
||||
Device.JavaScript)
|
||||
{
|
||||
renderLink = true;
|
||||
}
|
||||
|
||||
|
||||
if (renderLink)
|
||||
{
|
||||
writer.EnterStyle(Style);
|
||||
Form form = Control.Form;
|
||||
if (form.Action.Length > 0)
|
||||
{
|
||||
writer.Write("<a href=\"javascript:document.");
|
||||
writer.Write(form.ClientID);
|
||||
writer.Write(".submit()\"");
|
||||
AddAttributes(writer);
|
||||
writer.Write(">");
|
||||
writer.WriteText(Control.Text, true);
|
||||
writer.WriteEndTag("a");
|
||||
}
|
||||
else
|
||||
{
|
||||
RenderBeginLink(writer, Constants.FormIDPrefix + form.UniqueID);
|
||||
writer.WriteText(Control.Text, true);
|
||||
RenderEndLink(writer);
|
||||
}
|
||||
writer.ExitStyle(Style, Control.BreakAfter);
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.EnterLayout(Style);
|
||||
writer.WriteBeginTag("input");
|
||||
writer.WriteAttribute("name", Control.UniqueID);
|
||||
|
||||
if (renderImage)
|
||||
{
|
||||
writer.WriteAttribute("type", "image");
|
||||
writer.WriteAttribute("src", Control.ResolveUrl(Control.ImageUrl), true);
|
||||
writer.WriteAttribute("alt", Control.Text, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteAttribute("type", "submit");
|
||||
writer.Write(" value=\"");
|
||||
writer.WriteText(Control.Text, true);
|
||||
writer.Write("\"");
|
||||
}
|
||||
|
||||
AddAttributes(writer);
|
||||
writer.Write("/>");
|
||||
writer.ExitLayout(Style, Control.BreakAfter);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <include file='doc\HtmlCommandAdapter.uex' path='docs/doc[@for="HtmlCommandAdapter.LoadPostData"]/*' />
|
||||
public override bool LoadPostData(String key,
|
||||
NameValueCollection data,
|
||||
Object controlPrivateData,
|
||||
out bool dataChanged)
|
||||
{
|
||||
dataChanged = false;
|
||||
|
||||
// HTML input tags of type image postback with the coordinates
|
||||
// of the click rather than the name of the control.
|
||||
String name = Control.UniqueID;
|
||||
String postX = data[name + ".x"];
|
||||
String postY = data[name + ".y"];
|
||||
if (postX != null && postY != null
|
||||
&& postX.Length > 0 && postY.Length > 0)
|
||||
{
|
||||
// set dataChannged to cause RaisePostDataChangedEvent()
|
||||
dataChanged = true;
|
||||
return true;
|
||||
}
|
||||
// For other command control, defer to default logic in control.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,349 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <copyright file="HtmlControlAdapter.cs" company="Microsoft">
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System.Collections;
|
||||
using System.Diagnostics;
|
||||
using System.Web.UI.MobileControls;
|
||||
using System.Web.UI.MobileControls.Adapters;
|
||||
using System.Security.Permissions;
|
||||
|
||||
#if COMPILING_FOR_SHIPPED_SOURCE
|
||||
namespace System.Web.UI.MobileControls.ShippedAdapterSource
|
||||
#else
|
||||
namespace System.Web.UI.MobileControls.Adapters
|
||||
#endif
|
||||
|
||||
{
|
||||
/*
|
||||
* HtmlControlAdapter base class contains html specific methods.
|
||||
*
|
||||
* Copyright (c) 2000 Microsoft Corporation
|
||||
*/
|
||||
/// <include file='doc\HtmlControlAdapter.uex' path='docs/doc[@for="HtmlControlAdapter"]/*' />
|
||||
[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 HtmlControlAdapter : System.Web.UI.MobileControls.Adapters.ControlAdapter
|
||||
{
|
||||
/// <include file='doc\HtmlControlAdapter.uex' path='docs/doc[@for="HtmlControlAdapter.PageAdapter"]/*' />
|
||||
protected HtmlPageAdapter PageAdapter
|
||||
{
|
||||
get
|
||||
{
|
||||
return ((HtmlPageAdapter)Page.Adapter);
|
||||
}
|
||||
}
|
||||
|
||||
/// <include file='doc\HtmlControlAdapter.uex' path='docs/doc[@for="HtmlControlAdapter.FormAdapter"]/*' />
|
||||
protected HtmlFormAdapter FormAdapter
|
||||
{
|
||||
get
|
||||
{
|
||||
return (HtmlFormAdapter)Control.Form.Adapter;
|
||||
}
|
||||
}
|
||||
|
||||
/// <include file='doc\HtmlControlAdapter.uex' path='docs/doc[@for="HtmlControlAdapter.RequiresFormTag"]/*' />
|
||||
public virtual bool RequiresFormTag
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <include file='doc\HtmlControlAdapter.uex' path='docs/doc[@for="HtmlControlAdapter.Render"]/*' />
|
||||
public override void Render(HtmlTextWriter writer)
|
||||
{
|
||||
HtmlMobileTextWriter htmlWriter = (HtmlMobileTextWriter)writer;
|
||||
Render(htmlWriter);
|
||||
}
|
||||
|
||||
/// <include file='doc\HtmlControlAdapter.uex' path='docs/doc[@for="HtmlControlAdapter.Render1"]/*' />
|
||||
public virtual void Render(HtmlMobileTextWriter writer)
|
||||
{
|
||||
RenderChildren(writer);
|
||||
}
|
||||
|
||||
/// <include file='doc\HtmlControlAdapter.uex' path='docs/doc[@for="HtmlControlAdapter.RenderPostBackEventReference"]/*' />
|
||||
protected void RenderPostBackEventReference(HtmlMobileTextWriter writer, String argument)
|
||||
{
|
||||
PageAdapter.RenderPostBackEvent(writer, Control.UniqueID, argument);
|
||||
}
|
||||
|
||||
/// <include file='doc\HtmlControlAdapter.uex' path='docs/doc[@for="HtmlControlAdapter.RenderPostBackEventAsAttribute"]/*' />
|
||||
protected void RenderPostBackEventAsAttribute(
|
||||
HtmlMobileTextWriter writer,
|
||||
String attributeName,
|
||||
String argument)
|
||||
{
|
||||
writer.Write(" ");
|
||||
writer.Write(attributeName);
|
||||
writer.Write("=\"");
|
||||
RenderPostBackEventReference(writer, argument);
|
||||
writer.Write("\" ");
|
||||
}
|
||||
|
||||
/// <include file='doc\HtmlControlAdapter.uex' path='docs/doc[@for="HtmlControlAdapter.RenderPostBackEventAsAnchor"]/*' />
|
||||
protected void RenderPostBackEventAsAnchor(
|
||||
HtmlMobileTextWriter writer,
|
||||
String argument,
|
||||
String linkText)
|
||||
{
|
||||
writer.EnterStyle(Style);
|
||||
writer.WriteBeginTag("a");
|
||||
RenderPostBackEventAsAttribute(writer, "href", argument);
|
||||
writer.Write(">");
|
||||
writer.WriteText(linkText, true);
|
||||
writer.WriteEndTag("a");
|
||||
writer.ExitStyle(Style);
|
||||
}
|
||||
|
||||
/// <include file='doc\HtmlControlAdapter.uex' path='docs/doc[@for="HtmlControlAdapter.RenderBeginLink"]/*' />
|
||||
protected void RenderBeginLink(HtmlMobileTextWriter writer, String target)
|
||||
{
|
||||
bool queryStringWritten = false;
|
||||
bool appendCookieless = (PageAdapter.PersistCookielessData) &&
|
||||
(!( (target.StartsWith("http:", StringComparison.Ordinal)) || (target.StartsWith("https:", StringComparison.Ordinal)) ));
|
||||
writer.WriteBeginTag("a");
|
||||
writer.Write(" href=\"");
|
||||
|
||||
String targetUrl = null;
|
||||
String prefix = Constants.FormIDPrefix;
|
||||
if (target.StartsWith(prefix, StringComparison.Ordinal))
|
||||
{
|
||||
String name = target.Substring(prefix.Length);
|
||||
Form form = Control.ResolveFormReference(name);
|
||||
|
||||
if (writer.SupportsMultiPart)
|
||||
{
|
||||
if (form != null && PageAdapter.IsFormRendered(form))
|
||||
{
|
||||
targetUrl = PageAdapter.GetFormUrl(form);
|
||||
}
|
||||
}
|
||||
|
||||
if (targetUrl == null)
|
||||
{
|
||||
RenderPostBackEventReference(writer, form.UniqueID);
|
||||
appendCookieless = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.Write(targetUrl);
|
||||
queryStringWritten = targetUrl.IndexOf('?') != -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MobileControl control = Control;
|
||||
|
||||
// There is some adapter that Control is not set. And we
|
||||
// don't do any url resolution then. E.g. a page adapter
|
||||
if (control != null)
|
||||
{
|
||||
// AUI 3652
|
||||
target = control.ResolveUrl(target);
|
||||
}
|
||||
|
||||
writer.Write(target);
|
||||
queryStringWritten = target.IndexOf('?') != -1;
|
||||
}
|
||||
|
||||
IDictionary dictionary = PageAdapter.CookielessDataDictionary;
|
||||
if((dictionary != null) && (appendCookieless))
|
||||
{
|
||||
foreach(String name in dictionary.Keys)
|
||||
{
|
||||
if(queryStringWritten)
|
||||
{
|
||||
writer.Write('&');
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.Write('?');
|
||||
queryStringWritten = true;
|
||||
}
|
||||
writer.Write(name);
|
||||
writer.Write('=');
|
||||
writer.Write(dictionary[name]);
|
||||
}
|
||||
}
|
||||
|
||||
writer.Write("\"");
|
||||
AddAttributes(writer);
|
||||
writer.Write(">");
|
||||
}
|
||||
|
||||
/// <include file='doc\HtmlControlAdapter.uex' path='docs/doc[@for="HtmlControlAdapter.RenderEndLink"]/*' />
|
||||
protected void RenderEndLink(HtmlMobileTextWriter writer)
|
||||
{
|
||||
writer.WriteEndTag("a");
|
||||
}
|
||||
|
||||
// Can be used by adapter that allow its subclass to add more
|
||||
// specific attributes
|
||||
/// <include file='doc\HtmlControlAdapter.uex' path='docs/doc[@for="HtmlControlAdapter.AddAttributes"]/*' />
|
||||
protected virtual void AddAttributes(HtmlMobileTextWriter writer)
|
||||
{
|
||||
}
|
||||
|
||||
// Can be used by adapter that adds the custom attribute "accesskey"
|
||||
/// <include file='doc\HtmlControlAdapter.uex' path='docs/doc[@for="HtmlControlAdapter.AddAccesskeyAttribute"]/*' />
|
||||
protected virtual void AddAccesskeyAttribute(HtmlMobileTextWriter writer)
|
||||
{
|
||||
if (Device.SupportsAccesskeyAttribute)
|
||||
{
|
||||
AddCustomAttribute(writer, "accesskey");
|
||||
}
|
||||
}
|
||||
|
||||
// Can be used by adapter that adds custom attributes for
|
||||
// multi-media functionalities
|
||||
|
||||
private readonly static String [] _multiMediaAttributes =
|
||||
{ "src",
|
||||
"soundstart",
|
||||
"loop",
|
||||
"volume",
|
||||
"vibration",
|
||||
"viblength" };
|
||||
|
||||
/// <include file='doc\HtmlControlAdapter.uex' path='docs/doc[@for="HtmlControlAdapter.AddJPhoneMultiMediaAttributes"]/*' />
|
||||
protected virtual void AddJPhoneMultiMediaAttributes(
|
||||
HtmlMobileTextWriter writer)
|
||||
{
|
||||
if (Device.SupportsJPhoneMultiMediaAttributes)
|
||||
{
|
||||
for (int i = 0; i < _multiMediaAttributes.Length; i++)
|
||||
{
|
||||
AddCustomAttribute(writer, _multiMediaAttributes[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void AddCustomAttribute(HtmlMobileTextWriter writer,
|
||||
String attributeName)
|
||||
{
|
||||
String attributeValue = ((IAttributeAccessor)Control).GetAttribute(attributeName);
|
||||
if (!String.IsNullOrEmpty(attributeValue))
|
||||
{
|
||||
writer.WriteAttribute(attributeName, attributeValue);
|
||||
}
|
||||
}
|
||||
|
||||
/// <include file='doc\HtmlControlAdapter.uex' path='docs/doc[@for="HtmlControlAdapter.RenderAsHiddenInputField"]/*' />
|
||||
protected virtual void RenderAsHiddenInputField(HtmlMobileTextWriter writer)
|
||||
{
|
||||
}
|
||||
|
||||
// Renders hidden variables for IPostBackDataHandlers which are
|
||||
// not displayed due to pagination or secondary UI.
|
||||
internal void RenderOffPageVariables(HtmlMobileTextWriter writer, Control ctl, int page)
|
||||
{
|
||||
if (ctl.HasControls())
|
||||
{
|
||||
foreach (Control child in ctl.Controls)
|
||||
{
|
||||
// Note: Control.Form != null.
|
||||
if (!child.Visible || child == Control.Form.Header || child == Control.Form.Footer)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
MobileControl mobileCtl = child as MobileControl;
|
||||
|
||||
if (mobileCtl != null)
|
||||
{
|
||||
if (mobileCtl.IsVisibleOnPage(page)
|
||||
&& (mobileCtl == ((HtmlFormAdapter)mobileCtl.Form.Adapter).SecondaryUIControl ||
|
||||
null == ((HtmlFormAdapter)mobileCtl.Form.Adapter).SecondaryUIControl))
|
||||
{
|
||||
if (mobileCtl.FirstPage == mobileCtl.LastPage)
|
||||
{
|
||||
// Entire control is visible on this page, so no need to look
|
||||
// into children.
|
||||
continue;
|
||||
}
|
||||
|
||||
// Control takes up more than one page, so it may be possible that
|
||||
// its children are on a different page, so we'll continue to
|
||||
// fall through into children.
|
||||
}
|
||||
else if (mobileCtl is IPostBackDataHandler)
|
||||
{
|
||||
HtmlControlAdapter adapter = mobileCtl.Adapter as HtmlControlAdapter;
|
||||
if (adapter != null)
|
||||
{
|
||||
adapter.RenderAsHiddenInputField(writer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RenderOffPageVariables(writer, child, page);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
// SECONDARY UI SUPPORT
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
internal const int NotSecondaryUIInit = -1; // For initialization of private consts in derived classes.
|
||||
/// <include file='doc\HtmlControlAdapter.uex' path='docs/doc[@for="HtmlControlAdapter.NotSecondaryUI"]/*' />
|
||||
protected static readonly int NotSecondaryUI = NotSecondaryUIInit;
|
||||
|
||||
/// <include file='doc\HtmlControlAdapter.uex' path='docs/doc[@for="HtmlControlAdapter.SecondaryUIMode"]/*' />
|
||||
protected int SecondaryUIMode
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Control == null || Control.Form == null)
|
||||
{
|
||||
return NotSecondaryUI;
|
||||
}
|
||||
else
|
||||
{
|
||||
return ((HtmlFormAdapter)Control.Form.Adapter).GetSecondaryUIMode(Control);
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
((HtmlFormAdapter)Control.Form.Adapter).SetSecondaryUIMode(Control, value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <include file='doc\HtmlControlAdapter.uex' path='docs/doc[@for="HtmlControlAdapter.ExitSecondaryUIMode"]/*' />
|
||||
protected void ExitSecondaryUIMode()
|
||||
{
|
||||
SecondaryUIMode = NotSecondaryUI;
|
||||
}
|
||||
|
||||
/// <include file='doc\HtmlControlAdapter.uex' path='docs/doc[@for="HtmlControlAdapter.LoadAdapterState"]/*' />
|
||||
public override void LoadAdapterState(Object state)
|
||||
{
|
||||
if (state != null)
|
||||
{
|
||||
SecondaryUIMode = (int)state;
|
||||
}
|
||||
}
|
||||
|
||||
/// <include file='doc\HtmlControlAdapter.uex' path='docs/doc[@for="HtmlControlAdapter.SaveAdapterState"]/*' />
|
||||
public override Object SaveAdapterState()
|
||||
{
|
||||
int mode = SecondaryUIMode;
|
||||
if (mode != NotSecondaryUI)
|
||||
{
|
||||
return mode;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,92 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <copyright file="HtmlImageAdapter.cs" company="Microsoft">
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System.Security.Permissions;
|
||||
|
||||
#if COMPILING_FOR_SHIPPED_SOURCE
|
||||
namespace System.Web.UI.MobileControls.ShippedAdapterSource
|
||||
#else
|
||||
namespace System.Web.UI.MobileControls.Adapters
|
||||
#endif
|
||||
|
||||
{
|
||||
/*
|
||||
* HtmlImageAdapter class.
|
||||
*/
|
||||
/// <include file='doc\HtmlImageAdapter.uex' path='docs/doc[@for="HtmlImageAdapter"]/*' />
|
||||
[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 HtmlImageAdapter : HtmlControlAdapter
|
||||
{
|
||||
/// <include file='doc\HtmlImageAdapter.uex' path='docs/doc[@for="HtmlImageAdapter.Control"]/*' />
|
||||
protected new Image Control
|
||||
{
|
||||
get
|
||||
{
|
||||
return (Image)base.Control;
|
||||
}
|
||||
}
|
||||
|
||||
/// <include file='doc\HtmlImageAdapter.uex' path='docs/doc[@for="HtmlImageAdapter.Render"]/*' />
|
||||
public override void Render(HtmlMobileTextWriter writer)
|
||||
{
|
||||
String target = Control.NavigateUrl;
|
||||
|
||||
writer.EnterLayout(Style);
|
||||
if (!String.IsNullOrEmpty(target))
|
||||
{
|
||||
RenderBeginLink(writer, target);
|
||||
}
|
||||
|
||||
if (String.IsNullOrEmpty(Control.ImageUrl))
|
||||
{
|
||||
// Just write the alternate as text
|
||||
writer.EnsureStyle();
|
||||
writer.MarkStyleContext();
|
||||
writer.EnterFormat(Style);
|
||||
writer.WriteText(Control.AlternateText, true);
|
||||
writer.ExitFormat(Style);
|
||||
writer.UnMarkStyleContext();
|
||||
}
|
||||
else
|
||||
{
|
||||
RenderImage(writer);
|
||||
}
|
||||
|
||||
if (!String.IsNullOrEmpty(target))
|
||||
{
|
||||
RenderEndLink(writer);
|
||||
}
|
||||
writer.ExitLayout(Style, Control.BreakAfter);
|
||||
}
|
||||
|
||||
/// <include file='doc\HtmlImageAdapter.uex' path='docs/doc[@for="HtmlImageAdapter.RenderImage"]/*' />
|
||||
protected internal virtual void RenderImage(HtmlMobileTextWriter writer)
|
||||
{
|
||||
String source = Control.ImageUrl;
|
||||
|
||||
writer.WriteBeginTag("img");
|
||||
|
||||
if (!String.IsNullOrEmpty(source))
|
||||
{
|
||||
// AUI 3652
|
||||
source = Control.ResolveUrl(source);
|
||||
|
||||
writer.WriteAttribute("src", source, true /*encode*/);
|
||||
writer.AddResource(source);
|
||||
}
|
||||
|
||||
if (!String.IsNullOrEmpty(Control.AlternateText))
|
||||
{
|
||||
writer.WriteAttribute("alt", Control.AlternateText, true);
|
||||
}
|
||||
|
||||
writer.WriteAttribute("border", "0");
|
||||
writer.Write(" />");
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,79 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <copyright file="HtmlLabelAdapter.cs" company="Microsoft">
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.MobileControls;
|
||||
using System.Drawing;
|
||||
using System.Security.Permissions;
|
||||
|
||||
#if COMPILING_FOR_SHIPPED_SOURCE
|
||||
namespace System.Web.UI.MobileControls.ShippedAdapterSource
|
||||
#else
|
||||
namespace System.Web.UI.MobileControls.Adapters
|
||||
#endif
|
||||
|
||||
{
|
||||
/*
|
||||
* HtmlLabelAdapter class.
|
||||
*
|
||||
* Copyright (c) 2000 Microsoft Corporation
|
||||
*/
|
||||
/// <include file='doc\HtmlLabelAdapter.uex' path='docs/doc[@for="HtmlLabelAdapter"]/*' />
|
||||
[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 HtmlLabelAdapter : HtmlControlAdapter
|
||||
{
|
||||
/// <include file='doc\HtmlLabelAdapter.uex' path='docs/doc[@for="HtmlLabelAdapter.Control"]/*' />
|
||||
protected new TextControl Control
|
||||
{
|
||||
get
|
||||
{
|
||||
return (TextControl)base.Control;
|
||||
}
|
||||
}
|
||||
|
||||
/// <include file='doc\HtmlLabelAdapter.uex' path='docs/doc[@for="HtmlLabelAdapter.WhiteSpace"]/*' />
|
||||
protected internal bool WhiteSpace(String s)
|
||||
{
|
||||
if (s == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
int length = s.Length;
|
||||
for(int i = 0; i < length; i++)
|
||||
{
|
||||
char c = s[i];
|
||||
if(!Char.IsWhiteSpace(c))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <include file='doc\HtmlLabelAdapter.uex' path='docs/doc[@for="HtmlLabelAdapter.Render"]/*' />
|
||||
public override void Render(HtmlMobileTextWriter writer)
|
||||
{
|
||||
writer.EnterStyle(Style);
|
||||
if( (writer.BeforeFirstControlWritten) &&
|
||||
(Device.RequiresLeadingPageBreak) &&
|
||||
(String.IsNullOrEmpty(Control.Text) || WhiteSpace(Control.Text) ) )
|
||||
{
|
||||
writer.WriteBreak();
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteText(Control.Text, true);
|
||||
}
|
||||
writer.ExitStyle(Style, Control.BreakAfter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,55 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <copyright file="HtmlLinkAdapter.cs" company="Microsoft">
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// </copyright>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.MobileControls;
|
||||
using System.Drawing;
|
||||
using System.Security.Permissions;
|
||||
|
||||
#if COMPILING_FOR_SHIPPED_SOURCE
|
||||
namespace System.Web.UI.MobileControls.ShippedAdapterSource
|
||||
#else
|
||||
namespace System.Web.UI.MobileControls.Adapters
|
||||
#endif
|
||||
{
|
||||
/*
|
||||
* HtmlLinkAdapter class.
|
||||
*
|
||||
* Copyright (c) 2000 Microsoft Corporation
|
||||
*/
|
||||
/// <include file='doc\HtmlLinkAdapter.uex' path='docs/doc[@for="HtmlLinkAdapter"]/*' />
|
||||
[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 HtmlLinkAdapter : HtmlControlAdapter
|
||||
{
|
||||
/// <include file='doc\HtmlLinkAdapter.uex' path='docs/doc[@for="HtmlLinkAdapter.Control"]/*' />
|
||||
protected new Link Control
|
||||
{
|
||||
get
|
||||
{
|
||||
return (Link)base.Control;
|
||||
}
|
||||
}
|
||||
|
||||
/// <include file='doc\HtmlLinkAdapter.uex' path='docs/doc[@for="HtmlLinkAdapter.Render"]/*' />
|
||||
public override void Render(HtmlMobileTextWriter writer)
|
||||
{
|
||||
writer.EnterStyle(Style);
|
||||
String navigateUrl = Control.NavigateUrl;
|
||||
RenderBeginLink(writer, navigateUrl);
|
||||
writer.WriteText(String.IsNullOrEmpty(Control.Text) ? navigateUrl : Control.Text, true);
|
||||
RenderEndLink(writer);
|
||||
writer.ExitStyle(Style, Control.BreakAfter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user