Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / MIT / System / Web / UI / MobileControls / Adapters / XhtmlAdapters / XhtmlBasicPhoneCallAdapter.cs / 1305376 / XhtmlBasicPhoneCallAdapter.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
using System;
using System.Globalization;
using System.Security.Permissions;
using System.Web.Mobile;
using System.Web.UI.MobileControls;
using System.Web.UI.MobileControls.Adapters;
#if COMPILING_FOR_SHIPPED_SOURCE
namespace System.Web.UI.MobileControls.ShippedAdapterSource.XhtmlAdapters
#else
namespace System.Web.UI.MobileControls.Adapters.XhtmlAdapters
#endif
{
///
[AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermission(SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal)]
[Obsolete("The System.Web.Mobile.dll assembly has been deprecated and should no longer be used. For information about how to develop ASP.NET mobile applications, see http://go.microsoft.com/fwlink/?LinkId=157231.")]
public class XhtmlPhoneCallAdapter : XhtmlControlAdapter {
///
protected new PhoneCall Control {
get {
return base.Control as PhoneCall;
}
}
///
public override void Render(XhtmlMobileTextWriter writer)
{
ConditionalClearPendingBreak(writer);
Style style = Style;
StyleFilter filter = writer.CurrentStyleClass.GetFilter(style);
if ((filter & XhtmlConstants.Layout) != 0) {
ConditionalEnterLayout(writer, style);
}
if (Device.CanInitiateVoiceCall) {
String text = Control.Text;
String phoneNumber = Control.PhoneNumber;
if (text == null || text.Length == 0) {
text = phoneNumber;
}
writer.WriteBeginTag("a");
if ((String)Device["supportsWtai"] == "true") {
writer.Write(" href=\"wtai://wp/mc;");
}
else {
writer.Write(" href=\"tel:");
}
foreach (char ch in phoneNumber) {
if (ch >= '0' && ch <= '9' || ch == '#' || ch == '+') {
writer.Write(ch);
}
}
writer.Write("\"");
ConditionalRenderCustomAttribute(writer, XhtmlConstants.AccessKeyCustomAttribute);
String cssClass = GetCustomAttributeValue(XhtmlConstants.CssClassCustomAttribute);
if (CssLocation != StyleSheetLocation.PhysicalFile) {
String className = writer.GetCssFormatClassName(style);
if (className != null) {
writer.WriteAttribute ("class", className);
}
}
else if (cssClass != null && cssClass.Length > 0) {
writer.WriteAttribute ("class", cssClass, true /* encode */);
}
writer.Write(">");
writer.WriteEncodedText(text);
writer.WriteEndTag("a");
ConditionalSetPendingBreakAfterInline(writer);
}
else {
// Format the text string based on properties
String text = String.Format(
CultureInfo.CurrentCulture,
Control.AlternateFormat,
Control.Text,
Control.PhoneNumber);
String url = Control.AlternateUrl;
// If URI specified, create a link. Otherwise, only text is displayed.
if (url != null && url.Length > 0) {
String cssClass = GetCustomAttributeValue(XhtmlConstants.CssClassCustomAttribute);
String accessKey = GetCustomAttributeValue(XhtmlConstants.AccessKeyCustomAttribute);
RenderBeginLink(writer, url, accessKey, style, cssClass);
writer.WriteEncodedText(text);
RenderEndLink(writer);
ConditionalSetPendingBreakAfterInline(writer);
}
else {
writer.WritePendingBreak();
ConditionalEnterFormat(writer, style);
ConditionalRenderOpeningSpanElement(writer);
writer.WriteEncodedText(text);
ConditionalRenderClosingSpanElement(writer);
ConditionalExitFormat(writer, style);
ConditionalSetPendingBreak(writer);
}
}
if ((filter & XhtmlConstants.Layout) != 0) {
ConditionalExitLayout(writer, style);
}
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
using System;
using System.Globalization;
using System.Security.Permissions;
using System.Web.Mobile;
using System.Web.UI.MobileControls;
using System.Web.UI.MobileControls.Adapters;
#if COMPILING_FOR_SHIPPED_SOURCE
namespace System.Web.UI.MobileControls.ShippedAdapterSource.XhtmlAdapters
#else
namespace System.Web.UI.MobileControls.Adapters.XhtmlAdapters
#endif
{
///
[AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermission(SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal)]
[Obsolete("The System.Web.Mobile.dll assembly has been deprecated and should no longer be used. For information about how to develop ASP.NET mobile applications, see http://go.microsoft.com/fwlink/?LinkId=157231.")]
public class XhtmlPhoneCallAdapter : XhtmlControlAdapter {
///
protected new PhoneCall Control {
get {
return base.Control as PhoneCall;
}
}
///
public override void Render(XhtmlMobileTextWriter writer)
{
ConditionalClearPendingBreak(writer);
Style style = Style;
StyleFilter filter = writer.CurrentStyleClass.GetFilter(style);
if ((filter & XhtmlConstants.Layout) != 0) {
ConditionalEnterLayout(writer, style);
}
if (Device.CanInitiateVoiceCall) {
String text = Control.Text;
String phoneNumber = Control.PhoneNumber;
if (text == null || text.Length == 0) {
text = phoneNumber;
}
writer.WriteBeginTag("a");
if ((String)Device["supportsWtai"] == "true") {
writer.Write(" href=\"wtai://wp/mc;");
}
else {
writer.Write(" href=\"tel:");
}
foreach (char ch in phoneNumber) {
if (ch >= '0' && ch <= '9' || ch == '#' || ch == '+') {
writer.Write(ch);
}
}
writer.Write("\"");
ConditionalRenderCustomAttribute(writer, XhtmlConstants.AccessKeyCustomAttribute);
String cssClass = GetCustomAttributeValue(XhtmlConstants.CssClassCustomAttribute);
if (CssLocation != StyleSheetLocation.PhysicalFile) {
String className = writer.GetCssFormatClassName(style);
if (className != null) {
writer.WriteAttribute ("class", className);
}
}
else if (cssClass != null && cssClass.Length > 0) {
writer.WriteAttribute ("class", cssClass, true /* encode */);
}
writer.Write(">");
writer.WriteEncodedText(text);
writer.WriteEndTag("a");
ConditionalSetPendingBreakAfterInline(writer);
}
else {
// Format the text string based on properties
String text = String.Format(
CultureInfo.CurrentCulture,
Control.AlternateFormat,
Control.Text,
Control.PhoneNumber);
String url = Control.AlternateUrl;
// If URI specified, create a link. Otherwise, only text is displayed.
if (url != null && url.Length > 0) {
String cssClass = GetCustomAttributeValue(XhtmlConstants.CssClassCustomAttribute);
String accessKey = GetCustomAttributeValue(XhtmlConstants.AccessKeyCustomAttribute);
RenderBeginLink(writer, url, accessKey, style, cssClass);
writer.WriteEncodedText(text);
RenderEndLink(writer);
ConditionalSetPendingBreakAfterInline(writer);
}
else {
writer.WritePendingBreak();
ConditionalEnterFormat(writer, style);
ConditionalRenderOpeningSpanElement(writer);
writer.WriteEncodedText(text);
ConditionalRenderClosingSpanElement(writer);
ConditionalExitFormat(writer, style);
ConditionalSetPendingBreak(writer);
}
}
if ((filter & XhtmlConstants.Layout) != 0) {
ConditionalExitLayout(writer, style);
}
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- coordinatorfactory.cs
- StrokeNodeEnumerator.cs
- RotationValidation.cs
- Query.cs
- JobStaple.cs
- CodeCatchClause.cs
- QuotedPrintableStream.cs
- HtmlControlAdapter.cs
- SerializationObjectManager.cs
- HtmlInputPassword.cs
- ToolboxComponentsCreatedEventArgs.cs
- DataGridViewComponentPropertyGridSite.cs
- SiteOfOriginPart.cs
- TemplateControlBuildProvider.cs
- DecimalMinMaxAggregationOperator.cs
- DataGridItemEventArgs.cs
- HttpClientCredentialType.cs
- BrushConverter.cs
- RequiredAttributeAttribute.cs
- GZipDecoder.cs
- HMACSHA1.cs
- PartitionerStatic.cs
- DesignSurfaceServiceContainer.cs
- CaseInsensitiveComparer.cs
- HtmlControlPersistable.cs
- datacache.cs
- Freezable.cs
- TextLineResult.cs
- DocumentOrderQuery.cs
- XsltInput.cs
- CustomWebEventKey.cs
- TextBoxDesigner.cs
- IntPtr.cs
- CodeTypeMember.cs
- SoapMessage.cs
- Column.cs
- StringInfo.cs
- QilList.cs
- SourceItem.cs
- WorkflowStateRollbackService.cs
- XmlCountingReader.cs
- mediaeventshelper.cs
- Set.cs
- RegexInterpreter.cs
- MemberPath.cs
- AmbientEnvironment.cs
- PersonalizationProviderHelper.cs
- BuildProviderCollection.cs
- ApplicationHost.cs
- WebBrowserPermission.cs
- GuidelineCollection.cs
- CounterCreationData.cs
- MSHTMLHostUtil.cs
- SafeLocalMemHandle.cs
- DesignerDataConnection.cs
- login.cs
- LinqDataSourceSelectEventArgs.cs
- ObjectDataSourceStatusEventArgs.cs
- RootBuilder.cs
- DomainUpDown.cs
- SoapAttributeAttribute.cs
- StorageAssociationTypeMapping.cs
- StartUpEventArgs.cs
- BufferedWebEventProvider.cs
- ProgressBar.cs
- MobileControlsSectionHelper.cs
- ListItemCollection.cs
- ExtensionFile.cs
- followingquery.cs
- BoundField.cs
- GroupBox.cs
- DataStorage.cs
- VisualProxy.cs
- ImportStoreException.cs
- SqlProviderManifest.cs
- AttributeData.cs
- GatewayIPAddressInformationCollection.cs
- DataGridHeadersVisibilityToVisibilityConverter.cs
- TransformerTypeCollection.cs
- NativeObjectSecurity.cs
- PartitionResolver.cs
- _LoggingObject.cs
- ReaderWriterLockWrapper.cs
- DataViewSettingCollection.cs
- CompilationSection.cs
- TextParagraphCache.cs
- HttpUnhandledOperationInvoker.cs
- CustomWebEventKey.cs
- MouseActionConverter.cs
- RepeaterItemCollection.cs
- TranslateTransform.cs
- SystemWebSectionGroup.cs
- UserControl.cs
- DirectoryInfo.cs
- RoleManagerEventArgs.cs
- LogSwitch.cs
- FlowNode.cs
- DataGridViewImageCell.cs
- PlainXmlWriter.cs
- ScrollEvent.cs