Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / MIT / System / Web / UI / MobileControls / Adapters / WmlObjectListAdapter.cs / 1305376 / WmlObjectListAdapter.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- using System; using System.Collections; using System.Globalization; using System.IO; using System.Web; using System.Web.UI; 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 { /* * WmlObjectListAdapter provides WML rendering of Object List control. * * Copyright (c) 2000 Microsoft Corporation */ ///[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 WmlObjectListAdapter : WmlControlAdapter { private const String _backToList = "__back"; private const String _showMenu = "__menu"; private const String _showDetails = "__details"; private const String _showMoreFormat = "__more$({0})"; private const String _showMoreFormatAnchor = "__more{0}"; private const String _showMore = "__more"; private const int _modeItemMenu = 1; private const int _modeItemDetails = 2; /// protected new ObjectList Control { get { return (ObjectList)base.Control; } } /// public override void OnPreRender(EventArgs e) { base.OnPreRender(e); switch (Control.ViewMode) { case ObjectListViewMode.List: SecondaryUIMode = NotSecondaryUI; break; case ObjectListViewMode.Commands: SecondaryUIMode = _modeItemMenu; break; case ObjectListViewMode.Details: SecondaryUIMode = _modeItemDetails; break; } if(Control.MobilePage.ActiveForm == Control.Form && Control.Visible && Control.ViewMode == ObjectListViewMode.Commands && Control.Items.Count > 0) { Control.PreShowItemCommands (Control.SelectedIndex); } } /// public override void Render(WmlMobileTextWriter writer) { switch (Control.ViewMode) { case ObjectListViewMode.List: if (Control.HasControls()) { writer.BeginCustomMarkup(); RenderChildren(writer); writer.EndCustomMarkup(); return; } RenderItemsList(writer); break; case ObjectListViewMode.Commands: RenderItemMenu(writer, Control.Selection); break; case ObjectListViewMode.Details: if (Control.Selection.HasControls()) { writer.BeginCustomMarkup(); Control.Selection.RenderChildren(writer); writer.EndCustomMarkup(); return; } RenderItemDetails(writer, Control.Selection); break; } } /// public override void CreateTemplatedUI(bool doDataBind) { if (Control.ViewMode == ObjectListViewMode.List) { Control.CreateTemplatedItemsList(doDataBind); } else { Control.CreateTemplatedItemDetails(doDataBind); } } /// protected virtual void RenderItemsList(WmlMobileTextWriter writer) { bool rendersAcceptsInline = Device.RendersWmlDoAcceptsInline; bool rendersSelectsAsMenuCards = Device.RendersWmlSelectsAsMenuCards; bool rendersBreaksAfterAnchor = Device.RendersBreaksAfterWmlAnchor; int pageStart = Control.FirstVisibleItemIndex; int pageSize = Control.VisibleItemCount; ObjectListItemCollection items = Control.Items; if (pageSize == 0 || items.Count == 0) { return; } bool hasDefaultCommand = HasDefaultCommand(); bool onlyHasDefaultCommand = OnlyHasDefaultCommand(); bool requiresSecondScreen = HasItemDetails() || (!onlyHasDefaultCommand && HasCommands()); bool itemRequiresHyperlink = requiresSecondScreen || hasDefaultCommand; writer.EnterLayout(Style); int[] tableFieldIndices = null; if (ShouldRenderAsTable() && (tableFieldIndices = Control.TableFieldIndices).Length != 0) { writer.BeginCustomMarkup(); int fieldCount = tableFieldIndices.Length; writer.Write("
"); writer.RenderText(Control.AllFields[fieldIndex].Title); writer.Write(" | "); } writer.WriteLine("
"); if (field == 0 && itemRequiresHyperlink) { RenderPostBackEvent(writer, requiresSecondScreen ? String.Format(CultureInfo.InvariantCulture, _showMoreFormatAnchor, item.Index) : item.Index.ToString(CultureInfo.InvariantCulture), GetDefaultLabel(GoLabel), false, item[tableFieldIndices[0]], false, WmlPostFieldType.Raw); } else { writer.RenderText(item[tableFieldIndices[field]]); } writer.Write(" | "); } writer.WriteLine("
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- COM2ExtendedUITypeEditor.cs
- GlyphCollection.cs
- DataGridViewEditingControlShowingEventArgs.cs
- PageParserFilter.cs
- Visual3D.cs
- CRYPTPROTECT_PROMPTSTRUCT.cs
- SigningCredentials.cs
- XmlSerializationWriter.cs
- NamespaceListProperty.cs
- AnimationClock.cs
- InheritanceRules.cs
- ForeignKeyConstraint.cs
- ScrollBar.cs
- BinaryWriter.cs
- PagedDataSource.cs
- RtfToXamlLexer.cs
- AnonymousIdentificationSection.cs
- ChangePassword.cs
- TableSectionStyle.cs
- SelectManyQueryOperator.cs
- Literal.cs
- XmlSerializationGeneratedCode.cs
- APCustomTypeDescriptor.cs
- ConfigurationErrorsException.cs
- ILGenerator.cs
- CaseCqlBlock.cs
- XamlReader.cs
- Transform3DGroup.cs
- CngAlgorithm.cs
- AliasGenerator.cs
- PermissionListSet.cs
- WrappedOptions.cs
- XmlSchemaImporter.cs
- WebPartTransformerCollection.cs
- OutOfMemoryException.cs
- FilterEventArgs.cs
- ProjectionPlan.cs
- Schema.cs
- HandleCollector.cs
- EditBehavior.cs
- HttpListener.cs
- PaintValueEventArgs.cs
- CellConstant.cs
- ReferentialConstraint.cs
- XmlExtensionFunction.cs
- BCryptSafeHandles.cs
- CurrentChangedEventManager.cs
- SmuggledIUnknown.cs
- SqlServer2KCompatibilityAnnotation.cs
- ArcSegment.cs
- MemberAssignment.cs
- SelectionListComponentEditor.cs
- BitmapEffectDrawingContent.cs
- NoPersistScope.cs
- WindowInteropHelper.cs
- SHA1.cs
- ScriptHandlerFactory.cs
- MissingSatelliteAssemblyException.cs
- ExeContext.cs
- QueryOperationResponseOfT.cs
- Freezable.cs
- SafeLibraryHandle.cs
- TableLayoutPanel.cs
- Icon.cs
- HiddenFieldDesigner.cs
- WeakReferenceEnumerator.cs
- ConfigXmlCDataSection.cs
- CollectionView.cs
- Timer.cs
- ElementMarkupObject.cs
- MatrixTransform3D.cs
- StylusPointPropertyUnit.cs
- BindStream.cs
- FieldReference.cs
- figurelengthconverter.cs
- WindowsComboBox.cs
- CodeExporter.cs
- dataSvcMapFileLoader.cs
- XPathDescendantIterator.cs
- hresults.cs
- PropertyCondition.cs
- CheckBoxAutomationPeer.cs
- InternalConfigConfigurationFactory.cs
- GeometryGroup.cs
- ContentOnlyMessage.cs
- ObjectViewFactory.cs
- filewebrequest.cs
- CodeArgumentReferenceExpression.cs
- QueryableFilterRepeater.cs
- HtmlInputFile.cs
- BitmapEffectDrawing.cs
- RegisteredScript.cs
- TypeSystem.cs
- WebConfigurationFileMap.cs
- TimeSpanOrInfiniteConverter.cs
- TickBar.cs
- LoggedException.cs
- AppDomain.cs
- ButtonRenderer.cs
- ResourceSetExpression.cs